Hello, I have the following _search query:
{
"size": 0,
"aggs": {
"3": {
"terms": {
"field": "REGIONAL.keyword",
"order": {
"_count": "desc"
},
"size": 30
},
"aggs": {
"2": {
"terms": {
"field": "OFICINA_DESCRIPCION.keyword",
"order": {
"_count": "desc"
},
"size": 30
}
}
}
}
},
"query": {
"bool": {
"must": [],
"filter": [
{
"range": {
"HORA_INICIO": {
"gte": "2022-01-01T03:00:00.000Z",
"lte": "2022-05-06T20:05:53.807Z",
"format": "strict_date_optional_time"
}
}
}
],
"should": [],
"must_not": []
}
}
}
and I'm getting the following response:
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 10000,
"relation": "gte"
},
"max_score": null,
"hits": []
},
"aggregations": {
"3": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "MONTEVIDEO",
"doc_count": 24724,
"2": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "OFICINA COMERCIAL N° 1 CENTRO",
"doc_count": 6732
},
{
"key": "OFICINA COMERCIAL N° 4 UNIÓN",
"doc_count": 6012
},
{
"key": "OFICINA COMERCIAL N° 5 PASO MOLINO",
"doc_count": 4870
},
{
"key": "OFICINA COMERCIAL N° 3 GOES",
"doc_count": 3625
},
{
"key": "OFICINA COMERCIAL N° 6 POCITOS",
"doc_count": 3485
}
]
}
},
{ . . . . . continue
How can I get a response like this only with these fields ?:
{
"aggregations.3.buckets.key": value,
"aggregations.3.buckets.doc_count": value,
"aggregations.3.buckets.2.buckets.key": value,
"aggregations.3.buckets.2.buckets.doc_count": value
},
{
},
. . . .