# Is it possible to change doc\_count and key to something else

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856>\
**Category:** Elasticsearch\
**Created:** [August 30, 2017, 12:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856 "2017-08-30T12:55:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [August 30, 2017, 12:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856/1 "2017-08-30T12:55:55Z")

</div>

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  
}  
]  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 30, 2017, 1:28pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856/2 "2017-08-30T13:28:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [August 30, 2017, 2:08pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856/3 "2017-08-30T14:08:16Z")

</div>

is it possible to change "key" to "field\_name" and "doc\_count" to "count" ?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 30, 2017, 2:15pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856/4 "2017-08-30T14:15:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 27, 2017, 2:15pm UTC](https://discuss.elastic.co/t/is-it-possible-to-change-doc-count-and-key-to-something-else/98856/5 "2017-09-27T14:15:37Z")

</div>

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