Closed vishaltomar76 closed 2 years ago
@babenkoivan
I want to write a query something like curl -X GET "localhost:9200/sports/athlete/_search?size=0&pretty" -H 'Content-Type: application/json' -d' { "aggs" : { "athletes" : { "filters" : { "filters" : { "defenders" : { "term" : { "role" : "defender" }}, "forwards" : { "term" : { "role" : "forward" }} } }, "aggs" : { "avg_goals" : { "avg" : { "field" : "goals" } } } } } }
And Expecting below output ... "aggregations" : { "athletes" : { "buckets" : { "defenders" : { "doc_count" : 4, "avg_goals" : { "value" : 71.25 } }, "forwards" : { "doc_count" : 9, "avg_goals" : { "value" : 661.0 } } } } }
Hi @vishaltomar76, please check the documentation here.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
@babenkoivan
I want to write a query something like curl -X GET "localhost:9200/sports/athlete/_search?size=0&pretty" -H 'Content-Type: application/json' -d' { "aggs" : { "athletes" : { "filters" : { "filters" : { "defenders" : { "term" : { "role" : "defender" }}, "forwards" : { "term" : { "role" : "forward" }} } }, "aggs" : { "avg_goals" : { "avg" : { "field" : "goals" } } } } } }
And Expecting below output ... "aggregations" : { "athletes" : { "buckets" : { "defenders" : { "doc_count" : 4, "avg_goals" : { "value" : 71.25 } }, "forwards" : { "doc_count" : 9, "avg_goals" : { "value" : 661.0 } } } } }