Hi, I am trying to build an index for the hotel docs in travel-sample dataset, specifically for the field: reviews.date
The date format appears to be “YYYY-MM-DD hh-mm-ss zzz” yet I cannot get a result with the date range below.
I thought at first it just wasn’t indexing, but when I update the field to include only the date portion (substr(date,0,10)) it works fine even with a default index and the following query.
Can anyone confirm the same behaviour? Is it an issue with date parser?
For anyone else hitting datetime parsing issues in the hotel records of travel-sample, you can run this query to grab just the date (not time or timezone) portion there:
UPDATE travel-sample AS ts
SET r.date = SUBSTR(r.date,0,10) FOR r IN ts.reviews END
The problem here is with the datetime parser used. By default FTS expects dates to be in the format specified by RFC-3339, which is a specific profile of ISO-8601.
If you specify a custom datetime analyser with a custom layout like below which fits the actual format in the reviews.date field (“2014-04-11 09:10:19 +0300”), it should work.
Thanks Sreekanth, I really want to use that layout feature but haven’t got it to work yet.
Would you need to specify date formatting characters in the layout?
e.g.
YYYY-MM-DD HH:mm:ss Z ?
And what character would Go expect for the timezone offset?
Even with both these layouts (yours and mine) in the custom parser, I can’t get it to work against the default travel-sample hotel reviews.date object.
I’d love to know if it works for you
Good to see you!
Tyler