Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.1.3
-
0
-
Yes
Description
When trying to work with datetimes in FTS that have millisec precision like
"2011-01-03T23:00:02.093" |
Intuitively I want to make a layout (for a custom dateTime parser) as follows:
layout => 2006-01-02T15:04:05.000
But the above layout (and thus index def fragment below) WILL NOT WORK
"custDT": { |
"layouts": [ |
"2006-01-02T15:04:05.000" |
],
|
"type": "flexiblego" |
}
|
However either a +/-##:## time zone offset or a Z for UTC needed to be appended to the customer fields that have a date.
layout => 2006-01-02T15:04:05.000Z07:00
"custDT": { |
"layouts": [ |
"2006-01-02T15:04:05.000Z07:00" |
],
|
"type": "flexiblego" |
}
|
I test on reviews.date on the document hotel_10063 keyspace travel-sample._default._default modify the first reviews.date field to
"date": "2001-10-09T10:20:30.123-08:00"
First I verify we can do millisec precise searching ...
The below Search query will miss the updated hotel_10063 doc (it is designed to miss the one match)
{
|
"explain": true, |
"fields": [ |
"*" |
],
|
"highlight": { |
|
},
|
"query": { |
"field": "reviews.date", |
"inclusive_start": false, |
"inclusive_end": false, |
"start": "2001-10-09T10:20:30.124-08:00", |
"end": "2001-10-09T10:20:30.126-08:00" |
},
|
"size": 10, |
"from": 0 |
}
|
The below Search query works we only have a single millisecond that will match and it does
{
|
"explain": true, |
"fields": [ |
"*" |
],
|
"highlight": { |
|
},
|
"query": { |
"field": "reviews.date", |
"inclusive_start": false, |
"inclusive_end": false, |
"start": "2001-10-09T10:20:30.122-08:00", |
"end": "2001-10-09T10:20:30.124-08:00" |
},
|
"size": 10, |
"from": 0 |
}
|
But if we "store" the value in the index (I just did this in Advanced by checking [X] Store Dynamic Fields) the display of the hit truncates the millis - this is a bug BUT not a show stopper
The display from the doc hit when Query the FTS index HAS NO MILLIS ...
2001-10-09T18:20:30Z
I can adjust the data (and the Search Query) and the following works
"date": "2001-10-09T10:20:30.123-08:00" |
"date": "2001-10-09T10:20:30.123-01:00" |
"date": "2001-10-09T10:20:30.123-00:00" |
But this fails (**** this is the customer syntax I wanted to match **{}):{*}
"date": "2001-10-09T10:20:30.123"
Again the alternate syntax works when we add a trailing "Z" to the above
"date": "2001-10-09T10:20:30.123Z"
The display from the doc hit once again when Query the FTS index HAS NO MILLIS ...
2001-10-09T10:20:30Z
============= details of index definition ===============
{
|
"type": "fulltext-index", |
"name": "test3", |
"uuid": "53477d82821d655e", |
"sourceType": "gocbcore", |
"sourceName": "travel-sample", |
"sourceUUID": "df439ac1abb428ddd4c9fbfc8b8f64f7", |
"planParams": { |
"maxPartitionsPerPIndex": 1024, |
"indexPartitions": 1 |
},
|
"params": { |
"doc_config": { |
"docid_prefix_delim": "", |
"docid_regexp": "", |
"mode": "type_field", |
"type_field": "type" |
},
|
"mapping": { |
"analysis": { |
"date_time_parsers": { |
"custDT": { |
"layouts": [ |
"2006-01-02T15:04:05.000Z07:00" |
],
|
"type": "flexiblego" |
}
|
}
|
},
|
"default_analyzer": "standard", |
"default_datetime_parser": "custDT", |
"default_field": "_all", |
"default_mapping": { |
"dynamic": true, |
"enabled": true |
},
|
"default_type": "_default", |
"docvalues_dynamic": false, |
"index_dynamic": true, |
"store_dynamic": true, |
"type_field": "_type" |
},
|
"store": { |
"indexType": "scorch", |
"segmentVersion": 15 |
}
|
},
|
"sourceParams": {} |
}
|