Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›REST API ›API Watcher

Обновление настроек индекса Watcher

Новая справка по API

Для получения самых последних данных об API, обратитесь к API 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"
}

Настраиваемые настройки можно получить с помощью API Получение настроек индекса Watcher.

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/watcher-api-update-settings.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API