Elasticsearch filter on aggregation

2020-07-20 04:00发布

问题:

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?