【问题标题】:getting all monitors for a specific index in elasticsearch在 elasticsearch 中获取特定索引的所有监视器
【发布时间】:2021-06-02 15:36:48
【问题描述】:
我正在使用 elasticsearch opendistro 7.2。我有创建触发器的监视器。
我希望能够删除与特定索引相关的所有监视器(比如说“events_index”)。
这似乎不起作用,有什么想法我应该如何解决这个问题?
GET _opendistro/_alerting/monitors/_search
{"query": {"bool": {"should": [
{"term": {"monitor.inputs.search.indices": "events_index"}}
]}}}
【问题讨论】:
标签:
elasticsearch
elasticsearch-opendistro
【解决方案1】:
这应该可行:
GET _opendistro/_alerting/monitors/_search
{
"query": {
"nested": {
"path": "monitor.inputs",
"query": {
"match": {
"monitor.inputs.search.indices": "events_index"
}
}
}
}
}
或者,使用您提到的查询:
GET _opendistro/_alerting/monitors/_search
{
"query": {
"nested": {
"path": "monitor.inputs",
"query": {
"bool": {
"should": [
{
"term": {
"monitor.inputs.search.indices": {
"value": "events_index"
}
}
}
]
}
}
}
}
}