# How to get this Year and This Month with Date Range Query

**URL:** <https://discuss.elastic.co/t/how-to-get-this-year-and-this-month-with-date-range-query/252224>\
**Category:** Elasticsearch\
**Created:** [October 15, 2020, 3:20pm UTC](https://discuss.elastic.co/t/how-to-get-this-year-and-this-month-with-date-range-query/252224 "2020-10-15T15:20:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [October 15, 2020, 3:20pm UTC](https://discuss.elastic.co/t/how-to-get-this-year-and-this-month-with-date-range-query/252224/1 "2020-10-15T15:20:24Z")

</div>

Hi All

Currently i have a date field where data is distributed from 2015 to 2020

I am interested in retrieving

> This Year, Last Year, This Month, Last Month

I am able to retrieve `Rolling 1 Year = From : now-1y, To : now` using Range Query  
But more interested with Range Query or any other query , how we can achieve this?

Thanks

---

<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 12, 2020, 3:20pm UTC](https://discuss.elastic.co/t/how-to-get-this-year-and-this-month-with-date-range-query/252224/2 "2020-11-12T15:20:27Z")

</div>

Closed on November 12, 2020, 3:20pm UTC

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