Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Модули индексов ›Распределение фрагментов индекса

Приоритеты восстановления индексов

Нераспределённые фрагменты восстанавливаются в порядке приоритета, когда это возможно. Индексы сортируются по приоритету следующим образом:

  • необязательное значение index.priority (более высокое значение перед меньшим)
  • дата создания индекса (более позднее значение перед более ранним)
  • имя индекса (в алфавитном порядке)

Это означает, что по умолчанию новые индексы будут восстановлены перед старыми.

Используйте динамически обновляемое значение index.priority для каждого индекса, чтобы настроить порядок приоритета индексов. Например:

resp = client.indices.create(
    index="index_1",
)
print(resp)

resp1 = client.indices.create(
    index="index_2",
)
print(resp1)

resp2 = client.indices.create(
    index="index_3",
    settings={
        "index.priority": 10
    },
)
print(resp2)

resp3 = client.indices.create(
    index="index_4",
    settings={
        "index.priority": 5
    },
)
print(resp3)
response = client.indices.create(
  index: 'index_1'
)
puts response

response = client.indices.create(
  index: 'index_2'
)
puts response

response = client.indices.create(
  index: 'index_3',
  body: {
    settings: {
      'index.priority' => 10
    }
  }
)
puts response

response = client.indices.create(
  index: 'index_4',
  body: {
    settings: {
      'index.priority' => 5
    }
  }
)
puts response
const response = await client.indices.create({
  index: "index_1",
});
console.log(response);

const response1 = await client.indices.create({
  index: "index_2",
});
console.log(response1);

const response2 = await client.indices.create({
  index: "index_3",
  settings: {
    "index.priority": 10,
  },
});
console.log(response2);

const response3 = await client.indices.create({
  index: "index_4",
  settings: {
    "index.priority": 5,
  },
});
console.log(response3);
PUT index_1

PUT index_2

PUT index_3
{
  "settings": {
    "index.priority": 10
  }
}

PUT index_4
{
  "settings": {
    "index.priority": 5
  }
}

В приведённом примере:

  • index_3 будет восстановлен первым, так как имеет наивысший index.priority.
  • index_4 будет восстановлен следующим, так как имеет следующий по приоритету уровень.
  • index_2 будет восстановлен следующим, так как он был создан недавно.
  • index_1 будет восстановлен последним.

Это значение принимает целое число и может быть обновлено для активного индекса с помощью API обновления настроек индекса:

resp = client.indices.put_settings(
    index="index_4",
    settings={
        "index.priority": 1
    },
)
print(resp)
response = client.indices.put_settings(
  index: 'index_4',
  body: {
    'index.priority' => 1
  }
)
puts response
const response = await client.indices.putSettings({
  index: "index_4",
  settings: {
    "index.priority": 1,
  },
});
console.log(response);
PUT index_4/_settings
{
  "index.priority": 1
}

© 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/recovery-prioritization.html

Spec-Zone.ru

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