I have a parent and an array of nested objects called children. I am getting lat and lng(longitude) from my sql join query. I want to create geo_point in nested objects of parents contained in an array using lat and lng. I tried different methods but couldn't do it.
filter {
aggregate {
task_id => "%{id}"
code => "
map['id'] = event.get('id')
map['name'] = event.get('name')
map['lat'] = event.get('lat')
map['lng'] = event.get('lng')
map['list'] ||=
map['children'] ||=
if (event.get('child_id') != nil)
if !( map['list'].include? event.get('child_id') )
map['list'] << event.get('child_id')
map['children'] << {
'child_id' => event.get('child_id'),
'street_address' => event.get('street_address')
}
end
end
event.cancel()
"
push_previous_map_as_event => true
timeout => 15
}
mutate {
add_field => { "[children][location][lat]" => "%{lat}" }
add_field => { "[children][location][lon]" => "%{lng}" }
}
mutate {
convert => {"[location][lat]" => "float"}
convert => {"[location][lon]" => "float"}
}
}