I would like to aggregate some of the fields based on other nested fields.
Here is how my data looks like:
{
"place" => "abc",
"m_id" => 5099,
"address" => "Kurt-Schumacher-Ring 15-17",
"name" => "delta ",
"@version" => "1",
"v_id" => 4540,
"s_id" => 12560,
"plz" => "12345"
}
{
"place" => "cdf",
"m_id" => 5099,
"address" => "Kurt-Schumacher-Ring 15-17",
"name" => "delta",
"@version" => "1",
"v_id" => 4540,
"s_id" => 12560,
"plz" => "12345"
}
{
"place" => "cbc",
"m_id" => 529,
"address" => "Kurt-Schumacher-Ring 15-17",
"name" => "delta",
"@version" => "1",
"v_id" => 165,
"s_id" => 12568,
"plz" => "69000"
}
{
"ort" => "vbf",
"m_id" => 529,
"address" => "Kurt-Schumacher-Ring 15-17",
"name" => "delta ",
"@version" => "1",
"v_id" => 165,
"s_id" => 12568,
"plz" => "60000"
}
{
"ort" => "xyz",
"m_id" => 529,
"address" => "Kurt-Schumacher-Ring 15-17",
"name" => "delta ",
"@version" => "1",
"v_id" => 165,
"s_id" => 12568,
"plz" => "69999"
}
Now i want to aggregate them based on nested id [s_id][v_id][m_id] or [s_id][v_id] or [s_id][m_id]
In the new output I want to create a new field "all" which should have
place | plz address @ place | plz address
so for given input, following output
"all" => "abc | 12345 Kurt-Schumacher-Ring 15-17 @ cdf | 12345 Kurt-Schumacher-Ring 15-17
"m_id" => 5099,
"name" => "delta ",
"@version" => "1",
"v_id" => 4540,
"s_id" => 12560,
"plz" => "12345"
"all" => "cbc | 69000 Kurt-Schumacher-Ring 15-17 @ vbf | 60000 Kurt-Schumacher-Ring 15-17 @ xyz | 69999 Kurt-Schumacher-Ring"
"m_id" => 529,
"name" => "delta ",
"@version" => "1",
"v_id" => 165,
"s_id" => 12568,
How can I do this, any pointers??