Getting to geo_point types for maps

I'm trying to create a template before creating the index so that we can get to display location on maps.
We have multiple AWS Load Balancer and want to look from where traffic is coming from.

We use ElasticSearch Version 7.10.2

Index preferred name is alb-index-proj1, alex-index-proj2

Template I have is

{
        "order": 0,
        "template": "alb-index-*",
        "settings": {},
        "mappings": {
                "_default_": {
                        "properties": {
                                "location": {
                                        "type": "geo_point"
                                }
                        }
                }
        }
}

This is what happens when I tried to import through the Dev Console,

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters:  [_default_ : {properties={location={type=geo_point}}}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [_default_ : {properties={location={type=geo_point}}}]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Root mapping definition has unsupported parameters:  [_default_ : {properties={location={type=geo_point}}}]"
    }
  },
  "status" : 400
}

Can you help me find what I'm doing wrong here. Thank you!

Duh! This is the correct way.

PUT /_template/alb-index-geolocation
{
        "order": 0,
        "template": "aws-index-*",
        "settings": {},
        "mappings": {
                        "properties": {
                                "location": {
                                        "type": "geo_point"
                                }
                        }
        }
}
2 Likes

Thanks for sharing your solution!