# How to query based on month name

**URL:** https://discuss.elastic.co/t/how-to-query-based-on-month-name/176563
**Category:** Elasticsearch
**Created:** [April 12, 2019, 7:44am UTC](https://discuss.elastic.co/t/how-to-query-based-on-month-name/176563 "2019-04-12T07:44:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)
#### Post date: [April 12, 2019, 7:44am UTC](https://discuss.elastic.co/t/how-to-query-based-on-month-name/176563/1 "2019-04-12T07:44:55Z")

</div>

Hi ,

Is there any way to pass month name for timestamp field to query the data for a specific month ?

Like suppose I want to query some data for entire march month currently I am passing the timestamp in the following way:

"range": { "@timestamp": { "gte": 1551378600000, "lte": 1554056999999, "format": "epoch\_millis" } }

Is there any other straight forward way to pass month name directly ?

Thanks  
Niraj

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 12, 2019, 6:04pm UTC](https://discuss.elastic.co/t/how-to-query-based-on-month-name/176563/2 "2019-04-12T18:04:16Z")

</div>

hey,

you can change the `format` to resemble a string based date like `2019-03-01` and `2019-03-31` which will make it much easier to write a human readable query.

See [https://www.elastic.co/guide/en/elasticsearch/reference/7.0/mapping-date-format.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/mapping-date-format.html)

--Alex

---

<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: [May 10, 2019, 6:04pm UTC](https://discuss.elastic.co/t/how-to-query-based-on-month-name/176563/3 "2019-05-10T18:04:17Z")

</div>

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