It seems that a query_string with date math gets modified by the analyzer, and despite having read all the doc and searched everywhere, I can't find a way around it.
Here is a very basic example :
PUT twitter/_doc/1
{
"user" : "kimchy",
"post_date" : "2019-02-01T00:00:00",
"message" : "trying out Elasticsearch"
}
Then
GET twitter/_search
{
"query" : {
"query_string" : {
"analyzer" : "standard",
"query" : "post_date:[now-12M TO *]"
}
}
}
Gives no results, my tests seems to indicate that the query is converted from "now-12M" (months) to "now-12m" (minutes).
I really need the analyzer, so this is not really an option for me. The workaround that I have is to calculate the date in my app and concatenate it in the query, as the date string is not affected.
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.