When we have a NumricRangeQuery against an indexed date field, GSON sometimes converts the min and max value to a long value with scientific notatation. Elasticsearch is unable to parse that value and fails. Hibernate Search should configure GSON in a way that it does not output a long with scientific notatation when it has a query against a date value.
We have indexed fields like this: {{ @Temporal(TemporalType.TIMESTAMP) @Field(index=Index.YES) public Date getCreatedAt() { return DateUtil.clone(createdAt); } }} And build queries against those fields like this: NumericRangeQuery.newLongRange("createdAt", 1478789928000, null, true, true);
Hibernate Search builds the following JSON request out of this query: ... {"range":{"updatedAt":{"gte":1.478789928E12}}} ...
Elasticsearch then fails with this error: {"type":"parse_exception","reason":"failed to parse date field [1.478789928E12] with format [strict_date_optional_time||epoch_millis]"}
Tested with Elasticsearch 2.3.5 and 2.4.1 |
|