# Elasticsearch Birthday field

**URL:** https://discuss.elastic.co/t/elasticsearch-birthday-field/132836
**Category:** Elasticsearch
**Created:** [May 22, 2018, 2:08pm UTC](https://discuss.elastic.co/t/elasticsearch-birthday-field/132836 "2018-05-22T14:08:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![arpansahoo](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@arpansahoo](https://discuss.elastic.co/u/arpansahoo)
#### Post date: [May 22, 2018, 2:08pm UTC](https://discuss.elastic.co/t/elasticsearch-birthday-field/132836/1 "2018-05-22T14:08:35Z")

</div>

I have a Birthday date-field (format: MMddyyyy||MMdd) in my index. I want to search for exact birthday that a user search for (eg. 03221989) and the upcoming birthdays. I am able to get the exact birthday. But for upcoming birthdays, i tried:

Range query - "gte" : "now" -\> it won't work as now will also have a year field and I want to find 03221989 type Birthdays as well  
Range query - "gte" : "03221989" -\> with this i am able to sort the records in ascending order of Month  
Suppose in my index, I have 3 records as:  
"Birthday": "03221979"  
"Birthday": "05271988"  
"Birthday": "04161990"  
I want the elasticsearch query to return me in ascending order of month irrespective of year. Return data should be:  
"Birthday": "03221979"  
"Birthday": "04161990"  
"Birthday": "05271988"

Kindly someone help me on this..

---

<div class="post-metadata">

### Author: ![eedugon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eedugon/32/45404_2.png) [@eedugon](https://discuss.elastic.co/u/eedugon)
#### Post date: [May 22, 2018, 7:05pm UTC](https://discuss.elastic.co/t/elasticsearch-birthday-field/132836/2 "2018-05-22T19:05:42Z")

</div>

Duplicated topic:

> [@Birthday in Elasticsearch](https://discuss.elastic.co/t/birthday-in-elasticsearch/132785):
>
> I have a Birthday date-field (format: MMddyyyy||MMdd) in my index. I want to search for exact birthday that a user search for (eg. 03221989) and the upcoming birthdays. I am able to get the exact birthday. But for upcoming birthdays, i tried: Range query - "gte" : "now" -\> it won't work as now will also have a year field and I want to find 03221989 type Birthdays as well Range query - "gte" : "03221989" -\> with this i am able to sort the records in ascending order of Month Suppose in my index…

Let's follow up from one place.

Regards,  
Eduardo

---

<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: [June 19, 2018, 7:06pm UTC](https://discuss.elastic.co/t/elasticsearch-birthday-field/132836/3 "2018-06-19T19:06:13Z")

</div>

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