First, you need to create a template for your index that has a field mapped as geo_point. You can do this with the Dev Tool on kibana,with this tool you can communicate with the elasticsearch node and make searches, insert data or configure parameters.
You can see the mapping of one of your index with this command:
GET [index_id]/_mapping
in my case
GET gps-2017.08.10/_mapping
Using the mapping as a template, you can add a field(for example location) and map it as a geo_point (It's better to add a new field for the coordinates because if you use one you already had mapped differently in previous index, elasticsearch will give you error becouse the same field is mapped differently in two related indexes):
"gps-2017.08.10": {
"mappings": {
"logs": {
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"coordinates": {
"type": "geo_point"
},
"dev_addr": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"dev_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
"host": {
"type": "ip"
}
}
}
}
Then you can use this mapping to create a template, like this one:
{
"template": "gps-*",
"order": 0,
"settings": {
"index.mapping.ignore_malformed": true
},
"mappings": {
"logs": {
"properties": {
"coordinates": {
"type": "geo_point"
},
"@timestamp": {
"type": "date"
},
"@version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
"dev_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
"host": {
"type": "ip"
},
"dev_addr": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"dev_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
To add the new template to elasticsearch, you insert the next command in the dev tool followed by the template, the index identifier in my example would be 'gps':
PUT _template/[index_identifier]
[Template]
Once you have a template with a geo_point field defined, you can insert data in this index, the field coordinates must be formatted like this:
"coordinates": {
"lat": 41.12,
"lon": -71.34
}
"coordinates": "41.12,-71.34"
"coordinates": "drm3btev3e86"
"coordinates": [ -71.34, 41.12 ]
If you do this right and you have no conflict in the indexes mapping the maptiles pluging from kibana should work correctly.