Hello I am new to elastic world and I am trying to figure out how can I find if a field for example "text" (which represents the whole text indexed) has a date that is in a specific range ?
Example: In doc_1 in field "text" we have "I was born on 27/05/1995" and I want to check if this document has a date inside it, which is between 20/05/1995 and 30/05/1995.
If this is not possible then how can I take this date "27/05/1995" and store it into a new field when I am indexing this doc ? And can you give me a tip about the best approach when we talk about indexing documents containing dates ?
Thank you
I think you have multiple options here. To search for documents that are inside your date range you have to parse the dates from the texts and index them as date field in elasticsearch. You can either do that inside you application before you send the document to elasticsearch or you have a look at ingest nodes. Ingest nodes give you the opportunity to preprocess documents before indexing. https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html
As soon as you have documents in elasticsearch with a separate date field you can use a Range query to search: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html