Remember when we defined the index template mapping for our index? We defined the location field to be of geo_point type. The geo_point type accepts a value that is formatted as a string with latitude and longitude appended together, separated by a comma.
This is achieved by using the add_field operation to construct the location field, as follows:
add_field => {
"location" => "%{[lookupResult][0][latitude]},%{[lookupResult][0][longitude]}"
}
By now, we should have a new field called location added to our JSON payload, exactly as desired. Next, we will remove the undesirable fields.