elastic/elasticsearch-java

Support for geo distance sort on nested fields

cmbarbu opened this issue · 2 comments

Description

Nested sort seems to be available only for co.elastic.clients.elasticsearch._types.FieldSort, but not for co.elastic.clients.elasticsearch._types.GeoDistanceSort. Consequently, trying to sort by distance on a nested field yields an error:

"query_shard_exception","reason":"it is mandatory to set the [nested] context on the nested sort field: [geoLocation.geoPoint].

This used to be possible in 7.x. Are there any plans to support this again in 8.x?

Hello, thanks for reporting this! Seems like we're missing the option in GeoDistanceSort, it's a problem with the API specification used to produce the Java code, we'll fix it and regenerate the client to solve the issue.

Indeed, it seems the class GeoDistanceSort is missing the nested property:

https://github.com/elastic/elasticsearch-specification/blob/main/specification/_types/sort.ts#L58-L66

Would it help if I opened a ticket in that repo as well?