# Disabling key\_as\_string

**URL:** <https://discuss.elastic.co/t/disabling-key-as-string/19026>\
**Category:** Elasticsearch\
**Created:** [August 1, 2014, 11:22am UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026 "2014-08-01T11:22:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Griffin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_griffin/32/1358_2.png) [@James\_Griffin](https://discuss.elastic.co/u/James_Griffin)\
**Post date:** [August 1, 2014, 11:22am UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/1 "2014-08-01T11:22:21Z")

</div>

Hi,

We're performing some aggregations with size=0 on a lot of data, and I'm  
looking to optimise the transfer over the wire. Our responses look like  
this:

"buckets": [

- {
  - "key": 15,
  - "key\_as\_string": "15",
  - "doc\_count": 8183  
},

- {
  - "key": 100,
  - "key\_as\_string": "100",
  - "doc\_count": 4717  
},  
...

Obviously, the key\_as\_string field is adding nothing in this instance. Is  
there a way to ask for it to be excluded from the response?

Cheers,  
James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b13ffb0f-9698-4154-bdcf-5b48da79c0e5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b13ffb0f-9698-4154-bdcf-5b48da79c0e5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [August 1, 2014, 11:40am UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/2 "2014-08-01T11:40:24Z")

</div>

Hi James,

This issue was brought up recently in the github issues list[1] and has  
been fixed[2]. It should be available in the version 1.3.0.

[1] [Aggregations: Histogram Aggregation key Bug · Issue #6655 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/6655)

[2] [Fixed Histogram key\_as\_string bug by colings86 · Pull Request #6830 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/6830)

Regards,

Colin

On Friday, 1 August 2014 12:22:21 UTC+1, James Griffin wrote:

> Hi,
> 
> We're performing some aggregations with size=0 on a lot of data, and I'm  
> looking to optimise the transfer over the wire. Our responses look like  
> this:
> 
> "buckets": [
> 
> - {
> - "key": 15,
> - "key\_as\_string": "15",
> - "doc\_count": 8183  
> },
> 
> - {
> - "key": 100,
> - "key\_as\_string": "100",
> - "doc\_count": 4717  
> },  
> ...
> 
> Obviously, the key\_as\_string field is adding nothing in this instance. Is  
> there a way to ask for it to be excluded from the response?
> 
> Cheers,  
> James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/636f70bd-5f9b-4b9c-a280-f94afe2939f7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/636f70bd-5f9b-4b9c-a280-f94afe2939f7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![James\_Griffin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_griffin/32/1358_2.png) [@James\_Griffin](https://discuss.elastic.co/u/James_Griffin)\
**Post date:** [August 1, 2014, 1:04pm UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/3 "2014-08-01T13:04:52Z")

</div>

Hi Colin,

Thanks for getting back to me so quick. I'm running my query against a  
1.3.1 cluster and still seeing "key\_as\_string", even though no format  
parameter is in the query. My query is below:

{  
"query": {  
"filtered": {  
"query": {  
"match\_all": {}  
}  
}  
},  
"aggs": {  
"topics": {  
"terms": {  
"size": 10,  
"field": "content.topics"  
}  
}  
}  
}

In the mapping, the content.topics field is defined as an integer. The data  
was indexed pre-upgrade, though I can't imagine that would make a  
difference? Any ideas?

Thanks,  
James

On Friday, August 1, 2014 12:40:24 PM UTC+1, Colin Goodheart-Smithe wrote:

> Hi James,
> 
> This issue was brought up recently in the github issues list[1] and has  
> been fixed[2]. It should be available in the version 1.3.0.
> 
> [1] [Aggregations: Histogram Aggregation key Bug · Issue #6655 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/6655)
> 
> [2] [Fixed Histogram key\_as\_string bug by colings86 · Pull Request #6830 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/6830)
> 
> Regards,
> 
> Colin
> 
> On Friday, 1 August 2014 12:22:21 UTC+1, James Griffin wrote:
> 
> > Hi,
> > 
> > We're performing some aggregations with size=0 on a lot of data, and I'm  
> > looking to optimise the transfer over the wire. Our responses look like  
> > this:
> > 
> > "buckets": [
> > 
> > - {
> > - "key": 15,
> > - "key\_as\_string": "15",
> > - "doc\_count": 8183  
> > },
> > 
> > - {
> > - "key": 100,
> > - "key\_as\_string": "100",
> > - "doc\_count": 4717  
> > },  
> > ...
> > 
> > Obviously, the key\_as\_string field is adding nothing in this instance. Is  
> > there a way to ask for it to be excluded from the response?
> > 
> > Cheers,  
> > James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1159e4b9-4278-4187-8f78-d404bc73b016%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1159e4b9-4278-4187-8f78-d404bc73b016%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![James\_Griffin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_griffin/32/1358_2.png) [@James\_Griffin](https://discuss.elastic.co/u/James_Griffin)\
**Post date:** [August 1, 2014, 1:34pm UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/4 "2014-08-01T13:34:28Z")

</div>

Hi,

I dug into that PR and it seems it was solved for histograms but not for  
terms aggregations. I presume this is a new bug, then? Are there other  
aggregation types this should be solved for?

Thanks,  
James

On Friday, August 1, 2014 2:04:52 PM UTC+1, James Griffin wrote:

> Hi Colin,
> 
> Thanks for getting back to me so quick. I'm running my query against a  
> 1.3.1 cluster and still seeing "key\_as\_string", even though no format  
> parameter is in the query. My query is below:
> 
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> },  
> "aggs": {  
> "topics": {  
> "terms": {  
> "size": 10,  
> "field": "content.topics"  
> }  
> }  
> }  
> }
> 
> In the mapping, the content.topics field is defined as an integer. The  
> data was indexed pre-upgrade, though I can't imagine that would make a  
> difference? Any ideas?
> 
> Thanks,  
> James
> 
> On Friday, August 1, 2014 12:40:24 PM UTC+1, Colin Goodheart-Smithe wrote:
> 
> > Hi James,
> > 
> > This issue was brought up recently in the github issues list[1] and has  
> > been fixed[2]. It should be available in the version 1.3.0.
> > 
> > [1] [Aggregations: Histogram Aggregation key Bug · Issue #6655 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/6655)
> > 
> > [2] [Fixed Histogram key\_as\_string bug by colings86 · Pull Request #6830 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/6830)
> > 
> > Regards,
> > 
> > Colin
> > 
> > On Friday, 1 August 2014 12:22:21 UTC+1, James Griffin wrote:
> > 
> > > Hi,
> > > 
> > > We're performing some aggregations with size=0 on a lot of data, and I'm  
> > > looking to optimise the transfer over the wire. Our responses look like  
> > > this:
> > > 
> > > "buckets": [
> > > 
> > > - {
> > > - "key": 15,
> > > - "key\_as\_string": "15",
> > > - "doc\_count": 8183  
> > > },
> > > 
> > > - {
> > > - "key": 100,
> > > - "key\_as\_string": "100",
> > > - "doc\_count": 4717  
> > > },  
> > > ...
> > > 
> > > Obviously, the key\_as\_string field is adding nothing in this instance.  
> > > Is there a way to ask for it to be excluded from the response?
> > > 
> > > Cheers,  
> > > James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/15a97dd3-b3cf-46ea-a117-d0f7648b3c47%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/15a97dd3-b3cf-46ea-a117-d0f7648b3c47%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [August 1, 2014, 2:28pm UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/5 "2014-08-01T14:28:45Z")

</div>

Sorry, I assumed you were using the histogram aggregation. It was this  
aggregation that the fixed was applied to. I have opened issue #7125  
[https://github.com/elasticsearch/elasticsearch/issues/7125](https://github.com/elasticsearch/elasticsearch/issues/7125) to resolve  
this in the terms aggregation.

On Friday, 1 August 2014 14:04:52 UTC+1, James Griffin wrote:

> Hi Colin,
> 
> Thanks for getting back to me so quick. I'm running my query against a  
> 1.3.1 cluster and still seeing "key\_as\_string", even though no format  
> parameter is in the query. My query is below:
> 
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> },  
> "aggs": {  
> "topics": {  
> "terms": {  
> "size": 10,  
> "field": "content.topics"  
> }  
> }  
> }  
> }
> 
> In the mapping, the content.topics field is defined as an integer. The  
> data was indexed pre-upgrade, though I can't imagine that would make a  
> difference? Any ideas?
> 
> Thanks,  
> James
> 
> On Friday, August 1, 2014 12:40:24 PM UTC+1, Colin Goodheart-Smithe wrote:
> 
> > Hi James,
> > 
> > This issue was brought up recently in the github issues list[1] and has  
> > been fixed[2]. It should be available in the version 1.3.0.
> > 
> > [1] [Aggregations: Histogram Aggregation key Bug · Issue #6655 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/6655)
> > 
> > [2] [Fixed Histogram key\_as\_string bug by colings86 · Pull Request #6830 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/6830)
> > 
> > Regards,
> > 
> > Colin
> > 
> > On Friday, 1 August 2014 12:22:21 UTC+1, James Griffin wrote:
> > 
> > > Hi,
> > > 
> > > We're performing some aggregations with size=0 on a lot of data, and I'm  
> > > looking to optimise the transfer over the wire. Our responses look like  
> > > this:
> > > 
> > > "buckets": [
> > > 
> > > - {
> > > - "key": 15,
> > > - "key\_as\_string": "15",
> > > - "doc\_count": 8183  
> > > },
> > > 
> > > - {
> > > - "key": 100,
> > > - "key\_as\_string": "100",
> > > - "doc\_count": 4717  
> > > },  
> > > ...
> > > 
> > > Obviously, the key\_as\_string field is adding nothing in this instance.  
> > > Is there a way to ask for it to be excluded from the response?
> > > 
> > > Cheers,  
> > > James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/eba1e62b-553c-406a-9434-7d359f0dc9e9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/eba1e62b-553c-406a-9434-7d359f0dc9e9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![James\_Griffin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_griffin/32/1358_2.png) [@James\_Griffin](https://discuss.elastic.co/u/James_Griffin)\
**Post date:** [August 1, 2014, 2:33pm UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/6 "2014-08-01T14:33:25Z")

</div>

Cracking, thanks Colin

On Friday, August 1, 2014 3:28:45 PM UTC+1, Colin Goodheart-Smithe wrote:

> Sorry, I assumed you were using the histogram aggregation. It was this  
> aggregation that the fixed was applied to. I have opened issue #7125  
> [https://github.com/elasticsearch/elasticsearch/issues/7125](https://github.com/elasticsearch/elasticsearch/issues/7125) to resolve  
> this in the terms aggregation.
> 
> On Friday, 1 August 2014 14:04:52 UTC+1, James Griffin wrote:
> 
> > Hi Colin,
> > 
> > Thanks for getting back to me so quick. I'm running my query against a  
> > 1.3.1 cluster and still seeing "key\_as\_string", even though no format  
> > parameter is in the query. My query is below:
> > 
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "match\_all": {}  
> > }  
> > }  
> > },  
> > "aggs": {  
> > "topics": {  
> > "terms": {  
> > "size": 10,  
> > "field": "content.topics"  
> > }  
> > }  
> > }  
> > }
> > 
> > In the mapping, the content.topics field is defined as an integer. The  
> > data was indexed pre-upgrade, though I can't imagine that would make a  
> > difference? Any ideas?
> > 
> > Thanks,  
> > James
> > 
> > On Friday, August 1, 2014 12:40:24 PM UTC+1, Colin Goodheart-Smithe wrote:
> > 
> > > Hi James,
> > > 
> > > This issue was brought up recently in the github issues list[1] and has  
> > > been fixed[2]. It should be available in the version 1.3.0.
> > > 
> > > [1] [Aggregations: Histogram Aggregation key Bug · Issue #6655 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/6655)
> > > 
> > > [2] [Fixed Histogram key\_as\_string bug by colings86 · Pull Request #6830 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/6830)
> > > 
> > > Regards,
> > > 
> > > Colin
> > > 
> > > On Friday, 1 August 2014 12:22:21 UTC+1, James Griffin wrote:
> > > 
> > > > Hi,
> > > > 
> > > > We're performing some aggregations with size=0 on a lot of data, and  
> > > > I'm looking to optimise the transfer over the wire. Our responses look like  
> > > > this:
> > > > 
> > > > "buckets": [
> > > > 
> > > > - {
> > > > - "key": 15,
> > > > - "key\_as\_string": "15",
> > > > - "doc\_count": 8183  
> > > > },
> > > > 
> > > > - {
> > > > - "key": 100,
> > > > - "key\_as\_string": "100",
> > > > - "doc\_count": 4717  
> > > > },  
> > > > ...
> > > > 
> > > > Obviously, the key\_as\_string field is adding nothing in this instance.  
> > > > Is there a way to ask for it to be excluded from the response?
> > > > 
> > > > Cheers,  
> > > > James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6a7bdf43-6658-4cfd-8b85-efc91cf9d21e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a7bdf43-6658-4cfd-8b85-efc91cf9d21e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:11am UTC](https://discuss.elastic.co/t/disabling-key-as-string/19026/7 "2017-07-06T01:11:40Z")

</div>


