Mapping geo_point

Hi, i'm trying to put a custom index in order to change the type of my field [Geolocation] (currently is string) which contain coordinates like "42.12356,72.23523". When I put the mapping i have an error:


My mapping for the field [Geolocation]:
image
To create the new mapping i indexed a sample of my data and i only modified the type of my field so i don't understand error ignore_above as it works with dynamic mapping.
Thank you in advance for your help.

That's not a valid mapping, see https://www.elastic.co/guide/en/elasticsearch/reference/6.4/geo-point.html

Also please don't post pictures of text, they are difficult to read and some people may not be even able to see them.

Thanks for your response and advises @warkolm . I have ever read the doc but i don't understand how to represent it in my custom mapping.
I tried like this but it doesn't work
"Geolocation": {
"type": "geo_point as a string",
"norms": false,
"fields": {
"keyword": {
"type": "geo_point",
"location": "lat,lon"
"doc_values": true,
"ignore_above": 256
}
}
},
Sorry for lost time.

It simply needs to be;

"Geolocation": {
  "type": "geo_point"
}

Thank you @warkolm. I modify my template as you suggest:
"Geolocation": {
"type": "geo_point"
},
and i modify my logstash.conf like this:
output {
elasticsearch {
hosts => "elasticsearch:9200"
template => "/config-dir/custom_mapping.json"
manage_template => true
template_overwrite => true
index => "logstash-meta"
It runs without any error but in my index the field Geolocation is always a string type. I test with the type "geo_point as a string" because my field Geolocation is [43.12345,73.123456] but it doesn't work.

Did you delete the index?

Hello @dadoonet, yes I have deleted index before restart. For my tests I use a sample of data so I reindex the data for each test. My field "Geolocation" is a subfield extracted with a kv filter (with the option target => meta_pictures) from a field "metadata", in the mapping (GET /myindex) the name is Geolocation but in the index management it appears as meta_pictures.Geolocation. Thank you for your help.

Check with the GET template API that your template is correctly loaded in elasticsearch.

The template seems not loaded. I run HEAD _/template/logstash-, the response is error 404 not found. If I run GET /_template/logstash-meta the response is { }
It should be an error in my json file but I'm not able to identify what is wrong with the documentation. The head of my json file is wrote as below:
{
"order": 0,
"version": 60001,
"index_patterns": [
"logstash-
"
],
"settings": {
"index.number_of_replicas": "0",
"index": {
"refresh_interval": "5s"
}
},
"mappings": {
"doc": {
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},

Try to use manually the PUT template API.
That will tell you. Like the remaining comma at the end?

Or check logstash logs

OK there were syntax errors in my json file and an error in the type. #noob Now it works. Thank you for your help and your time @dadoonet.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.