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

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 )

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