elasticsearch-java
elasticsearch-java copied to clipboard
Unable to accept negative numbers in string in search_after for epoch_millis date format
Java API client version
7.17.1
Java version
17.0
Elasticsearch Version
7.17.1
Problem description
When passing a string that is negative number (e.g. "-1") as search_after field in search request for a date type sort field in epoch_millis date format, it refuses to accept the value, even though passing a negative integer -1 works fine.
The fix could be that on server-side it takes negative strings, or on the client side parse Hit.sort as JsonValue so that it allows long type, and allow SearchRequest.searchAfter to take JsonValue. The latter also fixes https://github.com/elastic/elasticsearch-java/issues/210.