elasticsearch - Two same level stats aggregation -
can have 2 same level aggregations? example want have 2 stats aggregation of 2 different fields in single bucket aggregation. how can particularly?
ok got solution
{ "size" : 0, "query" : { "filtered" : { "query" : { "match_all" : { } }, "filter" : { "and" : { "filters" : [ { "numeric_range" : { "transactiondate" : { "from" : "2013-08-01", "to" : "2013-11-01", "include_lower" : true, "include_upper" : true } } }] } } } }, "aggregations" : { "monthwise1" : { "date_range" : { "field" : "transactiondate", "ranges" : [ { "key" : "aug-2013", "from" : "2013-08-01", "to" : "2013-08-31" }, { "key" : "sep-2013", "from" : "2013-09-01", "to" : "2013-09-30" }, { "key" : "oct-2013", "from" : "2013-10-01", "to" : "2013-10-31" } ] }, "aggregations" : { "statfield1" : { "stats": { "field": "balance" } }, "statfield2" : { "stats": { "field": "discount" } } } } } }
Comments
Post a Comment