GeoDistance sort with nested field
Is your feature request related to a problem?
I am trying to sort the data using geo distance but the field is nested so I was trying provide a nested path but it seems there is no option available for that or it's clearly not visible/well documented how to do that.
What solution would you like?
A simple and easy way to add a nested path as we have that Sort Field
What alternatives have you considered?
I'd have to do the sorting in java unfortunately
This is the query that I have to build using java : ` GET /test/_search { "sort" : [ { "_geo_distance" : { "event_date.location.geo_coordinates": { "lat": 48.5073, "lon": 12.1601 }, //THIS IS MISSING "nested_path": "event_date",
"order" : "desc",
"unit" : "km",
"mode" : "max",
"distance_type" : "arc"
}
}
],
"query": { "match_all": { } } }
`
Looks like this is simply missing.
FYI, we have recently merged a beginning of a code generator that aims to resolve this entire class of problems (https://github.com/opensearch-project/opensearch-java/pull/366). There are a few things you can do to help:
- Ensure that the specification for these APIs in https://github.com/opensearch-project/opensearch-api-specification is correct, and add tests for them in that repo.
- Write tests in this repo for the scenarios that are broken like the ones you're reporting and manually fix any of these bugs.
The combination will ensure that as we switch to the generator we're not introducing regressions.
Support for nested sort in GeoDistanceSort was added in v2.22.0