Skip to content

DocumentAdapters converts sort values to string #2777

Closed
@whalewired

Description

@whalewired

When upgrading from 4.2.12 to 5.1.5 search_after on sorted date fields, that does not specify pattern, no longer works.

In 4.2.12 the returned sort value was Long (epoch_millis).

In 5.1.5 it is converted to a String.

It happens her:

org.springframework.data.elasticsearch.client.elc.DocumentAdapters

return new SearchDocumentAdapter(document, score, hit.sort().stream().map(TypeUtils::toString).toArray(),
				documentFields, highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());

If that String is used in search_after Elasticsearch fails with "failed to parse date field".

When it stays as a Long it works fine.

One could add "format" pattern to the sort part to fix this so it uses that pattern consistently, but the use of Long also worked, so my question is, why are these converted to string?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions