# Count total number of words from all documents from a specific field accordingly

**URL:** <https://discuss.elastic.co/t/count-total-number-of-words-from-all-documents-from-a-specific-field-accordingly/203003>\
**Category:** Elasticsearch\
**Created:** [October 10, 2019, 10:46am UTC](https://discuss.elastic.co/t/count-total-number-of-words-from-all-documents-from-a-specific-field-accordingly/203003 "2019-10-10T10:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noctis17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noctis17/32/41656_2.png) [@Noctis17](https://discuss.elastic.co/u/Noctis17)\
**Post date:** [October 10, 2019, 10:46am UTC](https://discuss.elastic.co/t/count-total-number-of-words-from-all-documents-from-a-specific-field-accordingly/203003/1 "2019-10-10T10:46:45Z")

</div>

Hello and good day!

Someone asked this question but no one seems answered or tried to suggest techniques: [Count the Number of words in the field Elastic search 6.2](https://discuss.elastic.co/t/count-the-number-of-words-in-the-field-elastic-search-6-2/121373)

Now, I'm trying to produce a report from Elasticsearch to count the number of **WORDS / TOKENS** from a specific field called **content**

Is there a proper `aggregation` for this?

For example, I have this query:

```
GET web/_search
{
  "query":{
     "bool":{
        "must":[
           {
              "query_string":{
                 "fields":[
                    "title",
                    "content"
                 ],
                 "query":"((\"Mayor Isko\") AND (\"Isko Moreno\") AND (\"Manila\" OR \"Divisoria\")) OR ((\"Mayor Isko Moreno\" OR \"Mayor Vico Sotto\") AND (\"Manila\" OR \"Pasig\"))"
              }
           },
           {
              "range":{
                 "pub_date":{
                    "from":1569456000,
                    "to":1570060800
                 }
              }
           }
        ]
     }
  }
}

```

And for example, this query produced **23 DOCUMENTS** , I want to make a response telling me how **MANY** words does those 23 documents contain?

---

<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:** [November 7, 2019, 10:47am UTC](https://discuss.elastic.co/t/count-total-number-of-words-from-all-documents-from-a-specific-field-accordingly/203003/2 "2019-11-07T10:47:01Z")

</div>

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