Skip to content

OpenSearch Service _geo_distance bug

0

Hello,

I think I may have run into a bug in the AWS OpenSearch service. I recently upgraded my OpenSearch clusters to the latest version 3.1, and they seem to mostly be working well.

One of them has one node with a single small index that includes some geopoint data. It's in a VPC and does not have Advanced security enabled.

My other cluster has two nodes, Advanced Security is enabled, and it has a public IP.

I wanted to try consolidating these clusters, so I added the index from the simple VPC cluster to this public cluster. Despite otherwise identical settings and completely identical index contents, queries on new index that sort on "_geo_distance" using a unit other than meters are failing with a search_phase_execution_exception error:

Cannot invoke "String.endsWith(String)" because "field" is null

The search succeeds when the "unit" is omitted or set to "m". But a "unit" of e.g. "mi" (or any other non-"m" value) triggers this error. Specifically a query containing:

{
  "sort": [{
    "_geo_distance": {
      "locations.coords": {"lat": 33.99, "lon": -118.47},
      "order": "asc",
      "unit": "mi"
    }
  }]
}

Fails unless "unit" is removed or set to "m". These same queries succeed on the original VPC cluster with Advanced Security disabled. Reindexing does not resolve the issue.

Thanks for any assistance you can provide, Alec

asked a year ago155 views

1 Answer
0

This appears to be a potential issue with the _geo_distance sort functionality in OpenSearch 3.1 when using Advanced Security features.

The error you're encountering ("Cannot invoke "String.endsWith(String)" because "field" is null") suggests there might be a bug in how the _geo_distance sort handles non-meter units when Advanced Security is enabled. The fact that the query works when the unit is omitted or set to "m" (meters), but fails with other units like "mi" (miles), points to a specific issue with unit conversion in this security context.

Since the same query works on your VPC cluster without Advanced Security enabled, this strongly suggests the issue is related to the interaction between the _geo_distance functionality and the Advanced Security features in OpenSearch 3.1.

As a workaround, you could:

  1. Continue using "m" as your unit and perform any necessary conversions in your application code
  2. Consider temporarily disabling Advanced Security if feasible for your use case
  3. Revert to a previous version of OpenSearch if this functionality is critical

I would recommend contacting AWS Support about this issue, as they can investigate further and potentially provide a patch or more specific guidance. This appears to be a legitimate bug that should be addressed by the OpenSearch Service team.
Sources
Open-Source Search Engine – Amazon OpenSearch Service Resources – Amazon Web Services

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.