# Agg results can't support long words

**URL:** https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590
**Category:** Elasticsearch
**Created:** [October 13, 2021, 8:16am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590 "2021-10-13T08:16:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![carpeDiem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carpediem/32/88362_2.png) [@carpeDiem](https://discuss.elastic.co/u/carpeDiem)
#### Post date: [October 13, 2021, 8:16am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/1 "2021-10-13T08:16:07Z")

</div>

Hello experts,  
I'm currently trying to excute aggregate request,but I can't get some results which the field value is a little long,and I can't find any information for the length of field value to aggregate on guide,this got me into trouble.Is there some relevant descriptions of the value length limit for aggregation?

 ![1634112636(1)](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fd4e7cc750ac13932e7c341f3a6aa27398246fa7.png)  
There is result.  
 ![1634112822(1)](https://us1.discourse-cdn.com/elastic/original/3X/7/d/7db90433f63bb908ff12ff367992952a29dd0a7c.png)  
the following result doesn't return the long value  
 ![1634112801(1)](https://us1.discourse-cdn.com/elastic/original/3X/d/e/def89dec9a385096dc4ec90329632f87ed62ed63.png)  
Is there some relevant descriptions of the value length limit for aggregation?  
Looking forward to any help! Thank you!

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [October 13, 2021, 1:38pm UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/2 "2021-10-13T13:38:21Z")

</div>

Hi,  
The `size` and `shard_size` parameters you call out define the maximum numbers of terms you want in the results.  
The problem you have is likely at index-time rather than query time. The large stack trace string probably [exceeds the default indexable size for keyword fields.](https://discuss.elastic.co/t/i-need-help-elasticsearch-does-not-match-my-regexp-wildcard-or-query-string-queries/239473).

One approach to aggregating on large values like this would be to index a hashcode for the string rather than the full value.  
If your content consists of a lot of things like these stack traces the [wildcard field](https://www.elastic.co/blog/find-strings-within-strings-faster-with-the-new-elasticsearch-wildcard-field) may also be of interest but pay attention to the flowchart at the end of the blog when deciding if it is appropriate

---

<div class="post-metadata">

### Author: ![carpeDiem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carpediem/32/88362_2.png) [@carpeDiem](https://discuss.elastic.co/u/carpeDiem)
#### Post date: [October 14, 2021, 5:34am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/3 "2021-10-14T05:34:34Z")

</div>

Thank you very much,I find,But how to index a hashcode for the string like you said.

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [October 14, 2021, 7:29am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/4 "2021-10-14T07:29:45Z")

</div>

You can do it

1. in any client code that presents the JSON (custom code, Logstash etc)
2. in an “ingest processor” that enriches the JSON on Elasticsearch nodes just before indexing or
3. in indexing code using the [murmur3](https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-murmur3.html) field type

---

<div class="post-metadata">

### Author: ![carpeDiem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carpediem/32/88362_2.png) [@carpeDiem](https://discuss.elastic.co/u/carpeDiem)
#### Post date: [October 27, 2021, 3:41am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/5 "2021-10-27T03:41:34Z")

</div>

Thank you very much!

---

<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: [November 24, 2021, 3:42am UTC](https://discuss.elastic.co/t/agg-results-cant-support-long-words/286590/6 "2021-11-24T03:42:23Z")

</div>

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