简体   繁体   English

ElasticSearch terms_stats查询-从结果中排除字词

[英]ElasticSearch terms_stats query - exclude terms from result

I currently have a terms facet that excludes certain terms from its results, using the exclude option. 我目前有一个术语方面,可以使用exclude选项从其结果中排除某些术语。 I tried the same with a term_stats facet but the same results are not dropped. 我对term_stats方面进行了相同的尝试,但未删除相同的结果。

I have looked at the Elasticsearch documentation ( http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet/ ) and see that the term_stats facet doesn't appear to have an exclude option. 我查看了Elasticsearch文档( http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet/ ),发现term_stats构面似乎没有排除选项。 Since I don't always trust my full interpretation of the elasticsearch docs I was looking to see if anybody had found a workaround (beyond processing out the results client-side). 由于我并不总是相信我对Elasticsearch文档的完整解释,因此我希望查看是否有人找到了解决方法(除了在客户端处理结果外)。

This facet doesn't work as expected: 此构面无法按预期工作:

"keywords_bad":{
  "terms_stats":{
    "size":100,
    "value_field":"retweet_count",
    "exclude":["http","consected"],
    "order":"total",
    "key_field":"text"
  }
}

whereas this facet works as expected: 而此方面按预期工作:

"keywords_good":{    
  "terms":{
    "size":100,
    "exclude":["http","consected"],
    "order":"count",
    "field":"text"
  }
}

Any reasonable suggestions would be appreciated, as this seems a little inconsistent. 任何合理的建议将不胜感激,因为这似乎有点不一致。

UPDATE 更新

Based on the accepted answer by imotov, I created an issue on GitHub at https://github.com/elasticsearch/elasticsearch/issues/2916 根据imotov接受的答案,我在GitHub上创建了一个问题, 网址https://github.com/elasticsearch/elasticsearch/issues/2916

terms_stats facet doesn't support exclude at the moment. terms_stats方面目前不支持排除。 I would suggest creating an issue on github asking for it to be added. 我建议在github上创建一个问题,要求添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM