# Cannot aggregate long string

**URL:** <https://discuss.elastic.co/t/cannot-aggregate-long-string/101552>\
**Category:** Elasticsearch\
**Created:** [September 23, 2017, 12:40am UTC](https://discuss.elastic.co/t/cannot-aggregate-long-string/101552 "2017-09-23T00:40:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thlai15](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@thlai15](https://discuss.elastic.co/u/thlai15)\
**Post date:** [September 23, 2017, 12:40am UTC](https://discuss.elastic.co/t/cannot-aggregate-long-string/101552/1 "2017-09-23T00:40:00Z")

</div>

I have an implementation where I need to aggregate strings of potentially long length. It appears not working in Elasticsearch. I ran the following example in Elasticsearch 5.5.1

Create the following two indexes:

{  
"name": "test001",  
"long\_string": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"  
}

{  
"name": "test002",  
"long\_string": "222222222222222"  
}

Run an aggregation query:

{  
"aggs": {  
"test\_long\_string": {  
"terms": {  
"field": "long\_string.keyword"  
}  
}  
}  
}

The results shows only the short string:

{  
"aggregations":  
{  
"test\_long\_string":  
{  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets":  
[  
{  
"key": "222222222222222",  
"doc\_count": 1  
}  
]  
}  
}  
}

Is there a way to configure Elasticsearch to increase the size limit of string in aggregation? Or is there a workaround?

Any suggestion will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![thlai15](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@thlai15](https://discuss.elastic.co/u/thlai15)\
**Post date:** [September 23, 2017, 4:21pm UTC](https://discuss.elastic.co/t/cannot-aggregate-long-string/101552/2 "2017-09-23T16:21:07Z")

</div>

I figured it was caused by the default value of "ignore\_above" for keyword. I recreated the index mapping to increase the value and it's now working.

---

<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:** [October 21, 2017, 4:21pm UTC](https://discuss.elastic.co/t/cannot-aggregate-long-string/101552/3 "2017-10-21T16:21:33Z")

</div>

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