Elasticsearch filter on aggregation

大憨熊 提交于 2020-01-01 15:39:07

问题


Since I couldn't find anything on Google:

Is it possible to filter on an aggregation in elasticsearch. Im thinking of someting like: Get all objects where SUM(obect.X) > 100.

Thanks in advance.

EDIT - Sample Data

I have the following document-structure:

{
  docKey : 1
  value: 2
},
{
  docKey: 1
  value: 5
},
{
  docKey:1
  value: 7
},
{
  docKey:2
  value:2
},...

I now want to query the docKey from the database where the sum of the value is bigger than X.

EDIT2

I found out that is something I have to do in my application logic. you can see it here


回答1:


This doesn't exactly answer your question but seeing as you were pretty vague i.e. posting no mapping, query or anything of that matter we can't help you. However I hope you'll be able to work it out for yourself with this fantastic article on aggregations. Best of luck.

Update - Maybe this is what you're looking for instead?



来源:https://stackoverflow.com/questions/21107995/elasticsearch-filter-on-aggregation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!