I use an ElasticSearch search request with composite aggregation in order to get a list of all different indexed values of one specific field. The result gives me all I need, but I don't need all that info contained.
Request:
{
"aggs": {
"my_buckets": {
"composite": {
"size": 10000,
"sources": [{
"my_stoid": {
"terms": {
"field": "stoId"
}
}
}
]
}
}
},
"size": 0
}
Response:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 15,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"composite#my_buckets": {
"after_key": {
"my_stoid": "KV"
},
"buckets": [{
"key": {
"my_stoid": "1"
},
"doc_count": 5
}, {
"key": {
"my_stoid": "2102"
},
"doc_count": 1
}, {
"key": {
"my_stoid": "8000"
},
"doc_count": 1
}, {
"key": {
"my_stoid": "9999"
},
"doc_count": 6
}, {
"key": {
"my_stoid": "KB"
},
"doc_count": 1
}, {
"key": {
"my_stoid": "KV"
},
"doc_count": 1
}
]
}
}
}
I only need the values "1", "2102", "8000"... from the buckets. Like so:
"buckets": ["1", "2102", "8000", "9999", "KB", "KV"]
Is there a way to achieve this?
filter_path)