OpenSearch: [BUG] NullPointerException in _geo_distance sort
Describe the bug
all shards failed, root_cause: [{null_pointer_exception Cannot invoke "String.endsWith(String)" because "field" is null
This occurs on Opensearch 3.0 with a geo_point field while sorting by distance.
"location_point": {
"type": "geo_point"
}
Changing unit from “km” to “m” fixed it on some requests but failed again when changing sort order from “asc” to “desc”
Related component
Search
To Reproduce
- Have a search index with geo_point field
- Sort by _geo_distance
{
"query": { "match_all": {} },
"sort": [ { "_geo_distance": { "location_point": [9.227400, 49.189800], "order": "desc", "unit": "km", "distance_type": "arc", "mode": "min", "ignore_unmapped": true } } ],
"size": 10
}
- Get an Exception
all shards failed, root_cause: [{null_pointer_exception Cannot invoke "String.endsWith(String)" because "field" is null
Expected behavior
Sorting works like in Opensearch 2.18
Additional Details
Plugins
Basic docker image:
Image with Bug: opensearchproject/opensearch:latest
Working image: opensearchproject/opensearch:2.18.0
Screenshots If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (12 by maintainers)
@owaiskazi19, I tried to reproduce in the latest. I think the original poster mentioned that 2.18 is fine but not the latest.
@arsonik Thank you so much for the detailed steps! I was able to reproduce the error. Now, I can try to understand what is wrong.
So if you start os with this command
http get / output
/geonames/_mapping?pretty
/geonames/_settings?pretty
few documents /geonames/_search?q=paris&pretty
and the query sorting by distance
you get
I have tried 3.0.0 and 3.1.0 Same error
With a simple docker run single node I’ll send u the complete command tomorrow !
@janschwarz I will try to see if anyone could reproduce it. This is a pretty strange issue.
@ajleong623 Can you please take an initial look on why it is failing?