更新 Watcher 索引设置

编辑

此 API 允许用户修改 Watcher 内部索引(.watches)的设置。只允许修改一部分设置。包括:

  • index.auto_expand_replicas
  • index.number_of_replicas

修改 Watcher 设置的示例

resp = client.watcher.put_watch(
    id="test_watch",
    trigger={
        "schedule": {
            "hourly": {
                "minute": [
                    0,
                    5
                ]
            }
        }
    },
    input={
        "simple": {
            "payload": {
                "send": "yes"
            }
        }
    },
    condition={
        "always": {}
    },
)
print(resp)
const response = await client.watcher.putWatch({
  id: "test_watch",
  trigger: {
    schedule: {
      hourly: {
        minute: [0, 5],
      },
    },
  },
  input: {
    simple: {
      payload: {
        send: "yes",
      },
    },
  },
  condition: {
    always: {},
  },
});
console.log(response);
PUT /_watcher/watch/test_watch
{
  "trigger": {
    "schedule": {
      "hourly": {
        "minute": [ 0, 5 ]
        }
      }
  },
  "input": {
    "simple": {
      "payload": {
        "send": "yes"
      }
    }
  },
  "condition": {
    "always": {}
  }
}
resp = client.perform_request(
    "PUT",
    "/_watcher/settings",
    headers={"Content-Type": "application/json"},
    body={
        "index.auto_expand_replicas": "0-4"
    },
)
print(resp)
response = client.watcher.update_settings(
  body: {
    'index.auto_expand_replicas' => '0-4'
  }
)
puts response
const response = await client.transport.request({
  method: "PUT",
  path: "/_watcher/settings",
  body: {
    "index.auto_expand_replicas": "0-4",
  },
});
console.log(response);
PUT /_watcher/settings
{
  "index.auto_expand_replicas": "0-4"
}

可以使用获取 Watcher 索引设置 API 检索可配置的设置。