Aggregation sum with filter

30 views
Skip to first unread message

Minn

unread,
Dec 12, 2016, 6:28:21 PM12/12/16
to Elastica - Elasticsearch PHP Client
Hello everybody,

I have the following list:

{
hist:  [{"date":"2016-10-30", "price":40000},{"date":"2016-11-30", "price":60000}]
...
}

I created an agregation sum by the field "price" and I added a match (for example: 2016-11-30) and I got a sum equals to 100000 but I should get 60000 because this was the date that I matched in the query.
I found some information on internet about to use a filter / nested Aggregation but I could not find any documentation/example about that and the only doc that I found is related to a class that has a addFilter function but it is no more in the last elasticaphp library.

Any ideas? 
Thanks

ruflin

unread,
Jan 10, 2017, 5:46:33 AM1/10/17
to Elastica - Elasticsearch PHP Client
Sorry for the late reply. In case it is still an issue, have a look at the test files in Elastica. There you can find example for most cases: https://github.com/ruflin/Elastica/tree/master/test/lib/Elastica/Test
Reply all
Reply to author
Forward
0 new messages