I want to re-index older data of geoip to geopoints.
previous data contains location in this format.
"geoip": {
"location": {
"lon": 67.0703,
"lat": 24.9206
}
}
I want to re-index location in geo point in array like this
"geoip": {
"location": [lon, lat]
}
this is mapping
PUT logs-audit-geopoint/_mapping/doc
{
"properties": {
"json":{
"properties": {
"geoip":{
"properties":{
"location": {
"type": "geo_point"
}
}
}
}
}
}
}
this is my request to perform re indexing.
POST _reindex
{
"source": {
"index": "logs-audit"
},
"dest": {
"index": "logs-audit-geopoint"
},
"script": {
"source": "def geoip = ctx._source.json.geoip; if(geoip != null) { geoip.location = [geoip.longitude, geoip.latitude]; }",
"lang": "painless"
}
}
Question it does not overriding location: {} to location: []