简体   繁体   中英

Elasticsearch filter on aggregation

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

This doesn't exactly answer your question but seeing as you were pretty vague ie 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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