Himanshu Jain
Himanshu Jain

Reputation: 41

Elasticsearch query for count the number of documents data in index

I want to get documents data count from Jan 2020 to April 2020 in particular index could your please let me know the query.

Upvotes: 1

Views: 1610

Answers (1)

Val
Val

Reputation: 217514

Using the _count endpoint with the following query should do:

GET index/_count                         <-- change your index name here
{
   "query": {
     "range": {
       "@timestamp": {                   <-- change your date field here
         "gte": "2020-01-01",
         "lte": "2020-04-01"
       }
     }
   }
}

Upvotes: 2

Related Questions