# Ordering of analyzed text in ElasticSearch aggregations

**URL:** <https://discuss.elastic.co/t/ordering-of-analyzed-text-in-elasticsearch-aggregations/59708>\
**Category:** Elasticsearch\
**Created:** [September 2, 2016, 8:23pm UTC](https://discuss.elastic.co/t/ordering-of-analyzed-text-in-elasticsearch-aggregations/59708 "2016-09-02T20:23:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalyc](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalyc](https://discuss.elastic.co/u/kalyc)\
**Post date:** [September 2, 2016, 8:23pm UTC](https://discuss.elastic.co/t/ordering-of-analyzed-text-in-elasticsearch-aggregations/59708/1 "2016-09-02T20:23:59Z")

</div>

I am writing a single value custom aggregation in Elastic Search and for this I need to use analyzed text. The problem that I am facing is that the aggregated text occurs in alphabetical order - for every chunk of text.

For example:  
Sample text:  
Shard1- Doc1 - "Hello how are you"  
Shard2- Doc1 - "I am good"

Aggregated text:  
[are, hello, how, you, am, good, i]

I would like to preserve the original order of the words in the text for the aggregation.  
Expected Aggregated text:  
[hello, how, are, you, i, am, good]

Is there any one here who has faced a similar problem and are there any work arounds for this? Can the ordering of the analyzed text be prevented some how?

Any help would be appreciated!

Thanks

---

<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 5, 2017, 10:22pm UTC](https://discuss.elastic.co/t/ordering-of-analyzed-text-in-elasticsearch-aggregations/59708/2 "2017-07-05T22:22:44Z")

</div>


