Hello everyone,
i'm currently struggling with geo coordinates in my elasticsearch and i can't find any solution to my problem.
I'm using the ingest-geoip plugin which allow me to process the incoming logs and add geolocalisation to my incoming IP.
Right now, i configured the following pipeline to process my entries :
PUT _ingest/pipeline/geoip_ips
{
"description" : "Translate les adresses IP Source en coordonnées",
"processors" : [
{
"geoip" : {
"field" : "IP_Source",
"properties" : ["location", "city_name", "country_iso_code"],
"ignore_failure" : true
}
}
]
}
This generate coordinates in two field : geoip.location.lat and geoip.location.lon.
I wanted to merge these two fields to make a geohash field which can be used later to be used in a map.
So i add this to my pipeline :
PUT _ingest/pipeline/geoip_ips
{
"description" : "Translate les adresses IP Source en coordonnées",
"processors" : [
{
"geoip" : {
"field" : "IP_Source",
"properties" : ["location", "city_name", "country_iso_code"],
"ignore_failure" : true
}
},
{
"set" : {
"field" : "geolocalisation",
"value" : "{{geoip.location.lat}},{{geoip.location.lon}}"
}
}
]
}
I also add in my mapping though a template the geolocalisation field as a geo_point. There is the piece of my template where i setup this :
"geolocalisation" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "geo_point"
}
}
}
But when the entries are processed, i got the following error for every entry processed by the pipeline. This is produced by the "set" processor :
{"took":28,"ingest_took":2,"errors":true,"items":[{"index":{"_index":"myindex","_type":"flb_type","_id":"vFgfpWkBJGtfi-AK9Sur","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse field [geolocalisation.keyword] of type [geo_point]","caused_by":{"type":"array_index_out_of_bounds_exception","reason":"0"}}}}
I can't find what is causing this and i'm thinking it's caused by the set processor trying to write with a string value in the geo_point field.
Using the simulate api does not throw error and it's working correctly ? (done in kibana) But it's writing in the field itself, not the geolocalisation.keyword :
POST _ingest/pipeline/_simulate
{
"pipeline" : {
"description" : "Translate les adresses IP Source en coordonnées",
"processors" : [
{
"geoip" : {
"field" : "IP_Source",
"properties" : ["location", "city_name", "country_iso_code"],
"ignore_failure" : true
}
},
{
"set" : {
"field" : "geolocalisation",
"value" : "{{geoip.location.lat}},{{geoip.location.lon}}"
}
}
]
},
"docs" : [
{ "_source": {"IP_Source":"8.8.8.8"} },
{ "_source": {"IP_Source":"8.8.8.8"} }
]
}
Result :
{
"docs" : [
{
"doc" : {
"_index" : "_index",
"_type" : "_type",
"_id" : "_id",
"_source" : {
"geoip" : {
"location" : {
"lon" : -97.822,
"lat" : 37.751
},
"country_iso_code" : "US"
},
"IP_Source" : "8.8.8.8",
"geolocalisation" : "37.751,-97.822"
},
"_ingest" : {
"timestamp" : "2019-03-22T14:30:20.800Z"
}
}
},
{
"doc" : {
"_index" : "_index",
"_type" : "_type",
"_id" : "_id",
"_source" : {
"geoip" : {
"location" : {
"lon" : -97.822,
"lat" : 37.751
},
"country_iso_code" : "US"
},
"IP_Source" : "8.8.8.8",
"geolocalisation" : "37.751,-97.822"
},
"_ingest" : {
"timestamp" : "2019-03-22T14:30:20.800Z"
}
}
}
]
}
The following message is processed correctly but it does not tell my why it's not working on my entries ...
It clearly tell me it cannot be done for the .keyword but i'm not really sure how to setup this with my current mapping and the set pipeline i configured