1

I have data in elasticsearch like this

"id": "edff12sd3"
"main_array": [
{
"id": "2308",
"name": "Grey Area",
"location": {
  "lat": 28.5696577,
  "lon": 77.3229933
 }
}
,
{
"id": "2274",
"name": "Tribute to The Beatles by Atul Ahuja- Live Music",
"location": {
  "lat": 29.5696577,
  "lon": 77.3229933
 }
}

Now i want to set geo_point for location field. I have tried in this way

{
"mappings": {
"search_data": {
  "properties": {
    "main_array.location": {
      "type": "geo_point"
    }
   }
  }
 }
}

but it throws me error

"type": "mapper_parsing_exception",
"reason": "Field name [main_array.location] cannot contain '.'"

can you please help me out. thanks

1 Answer 1

2

location is a property of the objects you store in main_array, so try like this:

{
  "mappings": {
    "search_data": {
      "properties": {
        "main_array": {
          "properties": {
            "location": {
              "type": "geo_point"
            }
          }
        }
      }
    }
  }
}

Note that as of ES 2.0 field names may not contain dots

Sign up to request clarification or add additional context in comments.

2 Comments

val i have one more question, can i check main_array that its lat long data exists within 50km ?
It would be best to ask another question since the subject is not related.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.