如何使用C# NEST客户端向ElasticSearch查询添加post_filter?

3
简单来说,我有这个查询:
POST /my_index/_search
{
   "query": {
      "filtered": {
         "query": {
            "query_string": {
               "query": "my_query_text"
            }
         }
      }
   },
   "post_filter": {
      "term": {
         "topics": [
            "top1",
            "top2"
         ]
      }
   },
   "aggs": {
      "authors": {
         "terms": {
            "field": "authors"
         }
      }
   }
}

我想使用C# NEST客户端来复制它。

但是我找不到在NEST客户端中添加post_filter的方法?

可以帮忙吗?

1个回答

2
SearchDescriptor中,它被方法"Filter"引用,而不是PostFilter
在github上有一个未解决的问题,涉及更合适的命名,很可能会在2.0中修复。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接