babenkoivan / elastic-scout-driver-plus

Extension for Elastic Scout Driver
MIT License
267 stars 52 forks source link

how to write custom aggregation query #102

Closed vishaltomar76 closed 2 years ago

vishaltomar76 commented 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 } } } } }

babenkoivan commented 2 years ago

Hi @vishaltomar76, please check the documentation here.

github-actions[bot] commented 2 years ago

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