Here is how my input data looks like:
{
"details": [
{
"place": "abc",
"group": 3,
"year": 2006,
"id": 1304,
"street": "xyz 14",
"lf_number": "0118",
"code": 4433,
"name": "abc coorperation",
"group2": 3817"
"group1": 32"
"postal_code": "22926",
"status": 2
},
{
"place": "cbc",
"group": 2,
"year": 2007,
"id": 4983,
"street": "mnc 14",
"lf_number": "0145",
"code": 4433,
"name": "abc coorperation",
"group2": 3817,
"group1": 32"
"postalcode": "22926",
"status": 2
}
],
"p_name": "anacin",
"@version": "1",
"id": 28841
}
I want to flatten this array more and combine various fields here. I am able to do that with one field but how can i use more than one field.
Here is what i have tried so far and it works for one field.
filter{
ruby {
code => "if(!event.get('[details][0]').nil?)
event.set('[status]',event.get('[details]').group_by { |m| {m['postal_code'],m['status']}}.join(','))
end"
}
}
This works only if i have one field. How can i group multiple fields here??