Is it possible to change doc_count and key to something else


(Varun) #1

When i do a aggregation i got result as this

Is it possible to change doc_count and key to something else ?

{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 26022,
"max_score": 0,
"hits": []
},
"aggregations": {
"mio": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "CITROEN",
"doc_count": 23854
},
{
"key": "BMW",
"doc_count": 2120
},
{
"key": "AUDI",
"doc_count": 32
}
]
}
}
}


(Thiago Souza) #2

Well, that depends on what you are aggregating on. If you want a different result, then you need to aggregate on different fields or just do different aggregations.


(Varun) #3

is it possible to change "key" to "field_name" and "doc_count" to "count" ?


(Thiago Souza) #4

No, it's not possible. There is no way to tell Elasticsearch to use a different json. You need to handle this at application level.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.