My date of birth is storing as this "1995-08-10 00:00:00.314"
ANd now I want to write a search query so that it can return the data according to the age of the person. My condition is I want to return data within 21-31 age, I tried below query but it didn't work
I will have multiple data just like in the image I attached. Those data will have "user.dateOfBirth" field in each data. Now I want to find the age according to that "user.dateOfBirth" field and return all the result which are in between age 21-30. I know it would be a lot easier if I had a number instead of that date in "user.dateOfBirth" field.
I tried your approach but it didn't work, and I also tried times range query but that also didn't work maybe there's a condition that I need to apply to query, but I don't know what is it.
Having a number would not be very useful as it changes over time
The query I sent to you works for me so I need more information why it does not work for you. If you can reproduce what it is not working for you, it would be very helpful. In the example you showed before the query only hits the record with date of birth in 1995 but of course it won't match the record in 2019.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.