OpenSearch not creating geo_point field type in new instances

0

There's seems to be an issue creating geo_point field types. We have a process that indexes a latitude and longitude coordinate that used to create a geo_point field type and now it creates two separate fields for the lat/lon as float types. This is a real problem since we can no longer perform geo distance searches. We haven't touched the code that performs the indexing so nothing has changed on our end and we can't even create geo_point field types on old version of Elasticsearch. What's going on and how do we create geo_point field types now?

asked 2 years ago588 views
1 Answer
0

Hi, can you please confirm the version of the Opensearch and maybe an example of data and the query?

I've tried the below using Opensearch 1.3 and it seems to be working as expected...

PUT testindex1
{
  "mappings": {
    "properties": {
      "point": {
        "type": "geo_point"
      }
    }
  }
}

PUT testindex1/_doc/1
{
  "point": { 
    "lat": 40.71,
    "lon": 74.00
  }
}

PUT testindex1/_doc/2
{
  "point": "txhxegj0uyp3"
}

GET testindex1/_search
{
  "query": {
    "geo_bounding_box": { 
      "point": {
        "top_left": {
          "lat": 42,
          "lon": -72
        },
        "bottom_right": {
          "lat": 40,
          "lon": -74
        }
      }
    }
  }
}
AWS
Alex_T
answered 2 years 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.

Guidelines for Answering Questions