# How to get the number of repetitions of a word in articles using aggregation?

**URL:** <https://discuss.elastic.co/t/how-to-get-the-number-of-repetitions-of-a-word-in-articles-using-aggregation/102323>\
**Category:** Elasticsearch\
**Created:** [September 30, 2017, 5:29am UTC](https://discuss.elastic.co/t/how-to-get-the-number-of-repetitions-of-a-word-in-articles-using-aggregation/102323 "2017-09-30T05:29:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bavimorteza](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@bavimorteza](https://discuss.elastic.co/u/bavimorteza)\
**Post date:** [September 30, 2017, 5:29am UTC](https://discuss.elastic.co/t/how-to-get-the-number-of-repetitions-of-a-word-in-articles-using-aggregation/102323/1 "2017-09-30T05:29:37Z")

</div>

I use 'term aggregation' to know how many times a word is repeated in elasticsearch. This method works properly for short string filed's.

my simple term aggregation :

```
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "analyze_wildcard": true,
            "query": "*"
          }
        }
      ],
      "must_not": []
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "terms": {
        "field": "msgtxt.keyword"
      }
    }
  }
}

```

but in long string filed with long text like 'articles' it returns some long sentences.

Is it possible to find the number of repetitions using 'term aggregation' or other methods? ( article text is in Arabic/Persian language )

---

<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 28, 2017, 5:29am UTC](https://discuss.elastic.co/t/how-to-get-the-number-of-repetitions-of-a-word-in-articles-using-aggregation/102323/2 "2017-10-28T05:29:39Z")

</div>

Closed on October 28, 2017, 5:29am UTC

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