Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ElasticSearch Aggregation test
DELETE test
PUT test/test/1
{"make":{"id":12,"name":"fiat"},"model":{"id":121,"name":"strada"}}
PUT test/test/2
{"make":{"id":12,"name":"fiat"},"model":{"id":122,"name":"palio"}}
PUT test/test/3
{"make":{"id":12,"name":"fiat"},"model":{"id":123,"name":"ka"}}
PUT test/test/4
{"make":{"id":12,"name":"fiat"},"model":{"id":124,"name":"uno"}}
PUT test/test/5
{"make":{"id":12,"name":"fiat"},"model":{"id":121,"name":"strada"}}
PUT test/test/6
{"make":{"id":12,"name":"fiat"},"model":{"id":122,"name":"palio"}}
PUT test/test/7
{"make":{"id":13,"name":"ford"},"model":{"id":125,"name":"escort"}}
PUT test/test/8
{"make":{"id":12,"name":"ford"},"model":{"id":126,"name":"fiesta"}}
PUT test/test/9
{"make":{"id":12,"name":"gm"},"model":{"id":127,"name":"astra"}}
GET test/_search
{
"size": 0,
"aggs": {
"make": {
"terms": {
"field": "make.name",
"size": 10
},
"aggs": {
"model": {
"terms": {
"field": "model.name",
"size": 10
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.