Multiple Document Evaluation

I want to get the sum of particular value coming in each document and want to get the overall result. Is this possible using painless? If not, is there any alternative for the same?

What about the sum aggregation?

I can use that, but in my case, I've to perform addition iff some conditions get satisfied in each document individually.
I think aggregation on "term" isn't possible in ElasticSearch??

I think that a query that filters the documents you want plus a sum agg should work.
But did you give it a try?

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

I also want to know, can painless perform multiple document evaluation?? Means, extracting a particular value from each document and performing some computation, on that particular values together.


"status" : "1",
"value" : "24"
"status" : "2",
"value" : "21"
"status" : "4",
"value" : "20"

Task willing to perform :

def count ==0;
if(doc['status'] == 1 OR doc['status'] == 4){

Then it's better to compute such a field at index time IMO

Thank you so much!! :slightly_smiling_face:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.