I do not manage to index GeoJSON data in Elasticsearch and create Tile Map with them.
--> Sending GeoJSON to ES:
curl -XPUT "http://localhost:9200/datas/data/3617" -d
'{
"geometry": {
"coordinates": [
7.040691666666667,
43.626736111111114
],
"type": "Point"
},
"properties": {
"createdAt": {
"$date": "2016-04-06T15:40:42.402Z"
},
"device": "000-0002",
"ind": 0,
"timestamp": {
"$date": "2016-04-06T16:40:41.000Z"
}
},
"type": "Feature"
}'
Check mapping
curl -XGET "http://localhost:9200/datas/data/_mapping"
{
"datas": {
"mappings": {
"data": {
"properties": {
"geometry": {
"properties": {
"coordinates": {
"type": "float"
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"properties": {
"properties": {
"createdAt": {
"properties": {
"$date": {
"type": "date"
}
}
},
"device": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ind": {
"type": "long"
},
"timestamp": {
"properties": {
"$date": {
"type": "date"
}
}
}
}
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
But when creating a Tile Map in Kibana, I have the following error in Kibana:
"No Compatible Fields: The "datas" index pattern does not contain any of the following field types: geo_point"
How should I change the mapping so the GeoJSON is usable in the Tile Map ?
EDIT 1
curl -XPUT "http://localhost:9200/datas/_mapping/data" -d '{
"data": {
"properties": {
"geometry": {
"type": "geo_shape"
}
}
}
}'
=> {"acknowledged":true}
$ curl -XGET "http://localhost:9200/datas/_mapping/data"
=> {"datas":{"mappings":{"data":{"properties":{"geometry":{"type":"geo_shape"}}}}}}
curl -XPUT "http://localhost:9200/datas/data/3617" -d
'{
"geometry": {
"coordinates": [
7.040691666666667,
43.626736111111114
],
"type": "Point"
},
}'
=> {"_index":"datas","_type":"data","_id":"3617","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
But when I try to create Tile Map, I have this error message
When I replace geo_shape with geo_point in the mapping, I have the following error when inserting a sample data:
curl -XPUT "http://localhost:9200/datas/data/3617" -d
'{
"geometry": {
"coordinates": [
7.040691666666667,
43.626736111111114
],
"type": "Point"
},
}'
{"error":{"root_cause":[{"type":"parse_exception","reason":"field must be either [lat], [lon] or [geohash]"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"parse_exception","reason":"field must be either [lat], [lon] or [geohash]"}},"status":400}