How to access [0] element in event array of objects inside of Elasticsearch Script


(Hacker 21) #1

I have an event created like so:
event.set("postal_codes", [{"zip" => event.get("zip"), "city" => event.get("city"), "state" => event.get("state"), "country" => event.get("country"), "freq" => event.get("freq"), "location" => {"lat" => event.get("lat"), "lon" => event.get("lon")}}])

... it is an array of objects created with the ruby filter plugin.

inside of an Elasticsearch Script for an update, how can I access it's 0th element? The below script simply returns null:
script => ' ctx._source.postal_codes.add(params.event.get("[postal_codes][0]"));'

any ideas?


(Hacker 21) #2

any thoughts ?


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.