ElasticSearch NEST - DeleteByQuery(...) 不起作用

ElasticSearch NEST - DeleteByQuery(...) does not work

我正在尝试使用 DeleteByQuery(..) 方法从 ElasticSearch 中删除特定文档,但它不起作用。我得到的响应显示 200 状态。

如果我搜索相同的查询,我可以得到结果。

下面是我的查询 -

 FilterContainer[] container = new FilterContainer[2];
 FilterContainer TypeFilter = new TermFilter
 {
   Field = "TYPE",
   Value = TableName
 };

 FilterContainer BRConnectionIDFilter = new TermFilter
 {
    Field = "BRCONNECTIONID",
    Value = BRConnectionID
 };

 container[0] = TypeFilter;
 container[1] = BRConnectionIDFilter;

 IDeleteResponse response = objElasticNestClient.DeleteByQuery<dynamic>(s => s.Index(ExtractionContext.ElasticSearchIndex).Query(b => b.Filtered(q => q.Query(a => a.MatchAll()).Filter(f => f.Bool(m => m.Must(container))))));

 if (!response.IsValid && response.ConnectionStatus.HttpStatusCode == 200)
 {
      throw new Exception("Delete failed for object " + TableName + ". Error: " + response.ServerError);
 }

我已将 INDEX 用作所有字段的 NOT_ANALYZED。

有人可以指导我吗?

它在替换如下查询后有效 -

IDeleteResponse response = objElasticNestClient.DeleteByQuery<dynamic>(s => s.Index(ExtractionContext.ElasticSearchIndex).Type(TableName).Query(b => b.Filtered(q => q.Query(a => a.MatchAll()).Filter(f => f.Term("BRCONNECTIONID", BRConnectionID)))));
if (!response.IsValid && response.ConnectionStatus.HttpStatusCode == 200)
{
  throw new Exception("Delete failed for object " + TableName + ". Error: " + response.ServerError);
}