Ich habe die unten von documnets gesetzt
Gibt es eine Möglichkeit wir
Nested Histogramm Abfrage in Elasticsearch
{"id": 1, "regions" : 111, "category" : 6, "Price" : 957}
{"id": 2, "regions" : 111, "category" : 6, "Price" : 829}
{"id": 3, "regions" : 111, "category" : 7, "Price" : 123}
{"id": 4, "regions" : 111, "category" : 7, "Price" : 129}
{"id": 5, "regions" : 111, "category" : 8, "Price" : 351}
{"id": 6, "regions" : 111, "category" : 8, "Price" : 225}
{"id": 7, "regions" : 112, "category" : 6, "Price" : 625}
{"id": 8, "regions" : 112, "category" : 6, "Price" : 599}
{"id": 9, "regions" : 112, "category" : 7, "Price" : 256}
{"id": 10, "regions" : 112, "category" : 7, "Price" : 129}
{"id": 11, "regions" : 112, "category" : 8, "Price" : 333}
{"id": 12, "regions" : 112, "category" : 8, "Price" : 444}
{"id": 13, "regions" : 112, "category" : 9, "Price" : 199}
{"id": 14, "regions" : 112, "category" : 9, "Price" : 149}
{"id": 15, "regions" : 112, "category" : 5, "Price" : 299}
{"id": 16, "regions" : 112, "category" : 5, "Price" : 349}
Ich brauche eine verschachtelte Histogramm Suche in Elasticsearch machen können eine Abfrage machen (können einige verschachtelte sein Histogramm oder anderes), um die Ausgabe im folgenden Format zu erhalten:
Jede Region sollte eine eigene Kategorie mit dem niedrigsten Preis haben.
[{
"regions" : 111,
[{
"category" : 6,
"Price" : 829
}, {
"category" : 7,
"Price" : 123
}, {
"category" : 8,
"Price" : 225
}
]
}, {
"regions" : 112,
[{
"category" : 6,
"Price" : 599
}, {
"category" : 7,
"Price" : 129
}, {
"category" : 8,
"Price" : 333
}, {
"category" : 9,
"Price" : 149
}, {
"category" : 5,
"Price" : 299
}
]
},
]
Thx im Voraus