Я хочу отфильтровать данные из групп агрегации.Я написал запрос как этот
{
"size":0,
"aggregations": {
"latestNode": {
"terms": {"field": "uri"},
"aggregations": {
"top_nodes": {
"top_hits": {
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"size" : 1
}
}
}
}
}
}
После этого я получаю результат следующим образом:
{
"took": 14,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 6,
"max_score": 0,
"hits": []
},
"aggregations": {
"latestNode": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "2FF70002AC01F743",
"doc_count": 2,
"top_nodes": {
"hits": {
"total": 2,
"max_score": null,
"hits": [
{
"_index": "VirtualDB",
"_type": "doc",
"_id": "E85FnWgBhR1fwKHvHfpI",
"_score": null,
"_source": {
"uri": "2FF70002AC01F743",
"status": "WARNING",
"name": "Test_20k_11Test1",
"timestamp": 1548664071116
},
"sort": [
1548664071116
]
}
]
}
}
},
{
"key": "vDB1234",
"doc_count": 2,
"top_nodes": {
"hits": {
"total": 2,
"max_score": null,
"hits": [
{
"_index": "VirtualDB",
"_type": "doc",
"_id": "Es5EnWgBhR1fwKHvm_r5",
"_score": null,
"_source": {
"uri": "vDB1234",
"status": "OK",
"name": "Test_20k_11Test",
"timestamp": 15486640781116
},
"sort": [
15486640781116
]
}
]
}
}
},
{
"key": "2FF70002AC01F744",
"doc_count": 1,
"top_nodes": {
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "VirtualDB",
"_type": "doc",
"_id": "Fc5GnWgBhR1fwKHvPvrm",
"_score": null,
"_source": {
"uri": "2FF70002AC01F744",
"status": "WARNING",
"name": "Test_20k_11Test1",
"timestamp": 1548664061116
},
"sort": [
1548664061116
]
}
]
}
}
},
{
"key": "vDB1235",
"doc_count": 1,
"top_nodes": {
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "VirtualDB",
"_type": "doc",
"_id": "Ec5DnWgBhR1fwKHvb_oe",
"_score": null,
"_source": {
"uri": "vDB1235",
"status": "OK",
"name": "Test_20k_11Test",
"timestamp": 15486640751116
},
"sort": [
15486640751116
]
}
]
}
}
}
]
}
}
}
Теперь я хочу удалить некоторые элементы из корзин на основе условия, как
если uri = vDB1234 и "status" = "OK", "name" = "Test_20k_11Test", то удалите
{
"uri": "vDB1234",
"status": "OK",
"name": "Test_20k_11Test",
"timestamp": 15486640781116
}
, который занимает второе место в корзинах агрегатов Заранее спасибо за помощь