Sub aggregations in elasticsearch -


i trying work out elasticsearch aggregations! want fetch users have same operations id anf each id match 2 other fields! it's aggregations upon aggregations! not understanding how go it! can structuring it??

from official documentation:

bucketing aggregations can have sub-aggregations (bucketing or metric). sub-aggregations computed buckets parent aggregation generates. there no hard limit on level/depth of nested aggregations (one can nest aggregation under "parent" aggregation, sub-aggregation of higher-level aggregation).

you should check out more verbose elasticsearch: definitive guide.

there can find complete examples, such following provided in chapter "aggregations » aggregation test-drive » adding metric mix":

get /cars/transactions/_search {    "size" : 0,    "aggs": {       "colors": {          "terms": {             "field": "color"          },          "aggs": {              "avg_price": {                 "avg": {                   "field": "price"                 }             }          }       }    } } 

this aggregation nesting avg metric inside terms bucket, generating average each color (compare guide).


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -