# Analyzer to store a document in n possible combinations (n being no. of words in doc)

**URL:** <https://discuss.elastic.co/t/analyzer-to-store-a-document-in-n-possible-combinations-n-being-no-of-words-in-doc/56508>\
**Category:** Elasticsearch\
**Created:** [July 27, 2016, 11:47am UTC](https://discuss.elastic.co/t/analyzer-to-store-a-document-in-n-possible-combinations-n-being-no-of-words-in-doc/56508 "2016-07-27T11:47:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamil](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@tamil](https://discuss.elastic.co/u/tamil)\
**Post date:** [July 27, 2016, 11:47am UTC](https://discuss.elastic.co/t/analyzer-to-store-a-document-in-n-possible-combinations-n-being-no-of-words-in-doc/56508/1 "2016-07-27T11:47:46Z")

</div>

If a document value is "jerry tom micky"  
it has to be anlayzed and stored as below  
"jerry tom micky"  
"jerry micky tom"  
"tom micky jerry"  
"tom jerry micky "  
"micky jerry tom"  
"micky tom jerry"

Any idea to achieve this?

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [July 27, 2016, 1:23pm UTC](https://discuss.elastic.co/t/analyzer-to-store-a-document-in-n-possible-combinations-n-being-no-of-words-in-doc/56508/2 "2016-07-27T13:23:01Z")

</div>

Hi @tamil,

I fear it is not possible to store this as this would lead to a combinatorial explosion and hence an insanely huge index. Just consider what would happen if one document contained just 20 words. This would lead to 20! = 2432902008176640000 combinations.

But maybe there is another way to solve this problem. Can you please describe what you want to achieve?

Daniel

---

<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:32pm UTC](https://discuss.elastic.co/t/analyzer-to-store-a-document-in-n-possible-combinations-n-being-no-of-words-in-doc/56508/3 "2017-07-05T22:32:32Z")

</div>

Closed on July 5, 2017, 10:32pm UTC


