Elasticsearch date-histogram aggregations default buckets

I am using elastic search's date_histogram to retrieve data
my query looks as follows:

POST

{
  "size": 0,
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@timestamp",
        "interval": "1h"
      }
    }
  },
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "format": "strict_date_optional_time",
              "gte": "2020-06-04T07:00:01.185Z",
              "lte": "2020-06-04T14:57:01.185Z"
            }
          }
        }
      ]
    }
  }
}

But I'm only getting 1 bucket as a result.

"buckets": [
                {
                    "key_as_string": "2020-06-04T09:00:00.000Z",
                    "key": 1591261200000,
                    "doc_count": 7
                }
            ]

I wish to get also empty buckets for all of the intervals where I have 0 docs.
Is it possible? or do I have to fill those buckets with 0 myself?
Thanks,

Guy

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