# Index word bigram with count

**URL:** <https://discuss.elastic.co/t/index-word-bigram-with-count/91157>\
**Category:** Elasticsearch\
**Created:** [June 28, 2017, 5:16pm UTC](https://discuss.elastic.co/t/index-word-bigram-with-count/91157 "2017-06-28T17:16:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabry993](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@Gabry993](https://discuss.elastic.co/u/Gabry993)\
**Post date:** [June 28, 2017, 5:16pm UTC](https://discuss.elastic.co/t/index-word-bigram-with-count/91157/1 "2017-06-28T17:16:04Z")

</div>

Hi,  
I would need to index text fields in this way:  
given a string "what's the weather like today?" I would like to index a document with all the word bigrams and their counts (also for single words) as fields:

> "what's" with count 1  
> "the" with count 1  
> ...  
> "what's the" with count 1  
> "the weather" with count 1  
> ...

Then, I need to be able to query for a word (or a bigram) and get its count over all documents.  
How should I do?  
Thank you!  
Gabriele

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [June 30, 2017, 7:54am UTC](https://discuss.elastic.co/t/index-word-bigram-with-count/91157/2 "2017-06-30T07:54:33Z")

</div>

a [shingle filter](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html) together with the[term suggester](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-term.html) might be sufficient for this. The question is why do you need the raw term frequencies?

---

<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 28, 2017, 8:00am UTC](https://discuss.elastic.co/t/index-word-bigram-with-count/91157/3 "2017-07-28T08:00:27Z")

</div>

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