I've got many docs in elasticsearch and I want to sum the field Verspätung by the field Linie.
When I say Kibana to sum the Verspätung , it sums all Verspätung fields of result. So I got following :
Linie Sum_verspätung
S5 82
EC218 82
But I want the following.
Linie Sum_verspätung
S5 76
EC218 6
My docs in ES look like this:
Example doc1:
{
"@old_timestamp" => "2020-01-09T1346",
"result" => [
[ 0] {
"Verspätung" => 3,
"Linie" => "EC218",
"ID" => "2020-01-09T14:04:00.000Z_8010101"
},
[ 1] {
"Bahntyp" => "S-Bahn",
"Verspätung" => 56,
"Linie" => "S5",
"ID" => "2020-01-09T14:48:00.000Z_8006698",
}
[ 2] {
"Bahntyp" => "S-Bahn",
"Verspätung" => 10,
"Linie" => "S5",
"ID" => "2020-01-09T14:48:00.000Z_8006556",
}
Example doc2:
{
"@old_timestamp" => "2020-01-09T1386",
"result" => [
[ 0] {
"Verspätung" => 3,
"Linie" => "EC218",
"ID" => "2020-01-09T14:04:00.000Z_8010101"
},
[ 1] {
"Bahntyp" => "S-Bahn",
"Verspätung" => 10,
"Linie" => "S5",
"ID" => "2020-01-09T14:48:00.000Z_8006698",
}