I a new in Elasticsearch and I have a problem for research. I use Spring data elasticsearch.
I have a single input for research and I would like to search a text in a string field AND in a date field.
In my mapping I have a field "beginDate" of type "date" but when I do the search, for example, "Jon", Elastic return an error "Invalid format" because "Jon" is not a valid format for a date.
I tested with a String field for "beginDate" but the problem is the format. In DB my format is "2018-02-11" and I would like to retrieve with the strings below :
- 11.02.2018
- 02.2018
- 2018
- 11 02 2018
- 02 2018
How can I do this ?
Thank you
Basically you want to do string search operations on the date field as well. You can specify the that the date is a
text
field and not adate
field and it has the standard analyzer (the default analyzer, it will tokenize the input and it will remove-
,.
etc). The only thing you have to do is to stringify your date before indexing that value in elasticsearch.