You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Pagination fails when no datetime is set on the STAC Items. This is caused by the way the pagination token for the search_after parameter is constructed.
The pagination token is the string concatenation of all the sort keys. If no datetime value is set on the document, the sort values will look like this from Elasticsearch/Opensearch:
[-9223372036854775808,"<id>","<collection_id>"]
The pagination token (before base64 encoding) is then "-9223372036854775808,<id>,<collection>".
All these sort keys are converted to strings upon decoding the pagination token in the next request:
["-9223372036854775808","<id>","<collection_id>"]
The conversion of the string representation of this number to a number fails in Elasticsearch when the query is executed.
To Reproduce
Steps to reproduce the behavior:
Create a collection and items without properties.datetime value.
Try to search via the /search endpoint.
Request the next page via the pagination links in the response body.
Error message:
{
"code": "RequestError",
"description": "RequestError(400, 'search_phase_execution_exception', 'failed to parse date field [-9223372036854775808] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [-9223372036854775808] with format [strict_date_optional_time||epoch_millis]]')"
}
Expected behavior
Successful retrieval of the next pages.
Additional context
Could be solved by using other format for pagination token, e.g. base64 encoding of JSON string dump instead of string concatenation of values with comma separator.
The text was updated successfully, but these errors were encountered:
StijnCaerts
added a commit
to StijnCaerts/stac-fastapi-elasticsearch
that referenced
this issue
Dec 10, 2024
Describe the bug
Pagination fails when no datetime is set on the STAC Items. This is caused by the way the pagination token for the
search_after
parameter is constructed.The pagination token is the string concatenation of all the sort keys. If no datetime value is set on the document, the sort values will look like this from Elasticsearch/Opensearch:
The pagination token (before base64 encoding) is then "-9223372036854775808,<id>,<collection>".
All these sort keys are converted to strings upon decoding the pagination token in the next request:
The conversion of the string representation of this number to a number fails in Elasticsearch when the query is executed.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Successful retrieval of the next pages.
Additional context
Could be solved by using other format for pagination token, e.g. base64 encoding of JSON string dump instead of string concatenation of values with comma separator.
The text was updated successfully, but these errors were encountered: