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: {code:java} @Temporal(TemporalType.TIMESTAMP) @Field(index=Index.YES) public Date getCreatedAt() { return DateUtil.clone(createdAt); } {code}
And build queries against those fields like this: {code:java}NumericRangeQuery.newLongRange("createdAt", 1478789928000, null, true, true);{code}
Hibernate Search builds the following JSON request out of this query: {code:java} ... {"range":{"updatedAt":{"gte":1.478789928E12}}} ... { java code }
Elasticsearch then fails with this error: {code:java} {"type":"parse_exception","reason":"failed to parse date field [1.478789928E12] with format [strict_date_optional_time||epoch_millis]"} {code}
Tested with Elasticsearch 2.3.5 and 2.4.1 |
|