So what's happening is you haven't told Elasticsearch what the date format of that publish-date is. By default, Elasticsearch uses strict_date_optional_time||epoch_millis. That 20160921000000 value could be epoch_millis, and if it were epoch milliseconds, the date would be Tuesday, November 15, 2608 11:50:00 PM GMT.
You can verify that this is what it thinks, as the following does produce a hit on that document:
I see ... I was trying the second option you mentioned ... "you can supply the format parameter to your mapping for the date fields to tell Elasticsearch what you’re sending1."
Correct. And in general, you probably should reindex even if you didn't want to use now since the date values that Elasticsearch thinks it has are incorrect and I suspect you'll have more troubles down the line. For example, if you don't reindex,
will produce a date histogram with "key_as_string": "2608-11-01T00:00:00.000Z" even though the key may be 20159625600000, and even if you use your numeric form of query. Reindexing now will likely save you a lot of trouble later as you have more complicated queries.
Got it!
Well, thanks a tonne.
More than solution to my problem, I learnt a great deal more about elastic search. Appreciate all your help and patience.
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.