elasticsearch config_error ai_generated true

InvalidAliasNameException: alias [logs_current] points to missing index [logs-2025.03]

ID: elasticsearch/alias-points-to-missing-index

Also available as: JSON · Markdown · 中文
93%Fix Rate
85%Confidence
1Evidence
2024-02-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.17.12 active
8.11.0 active
8.13.0 active

Root Cause

An alias is configured to reference an index that has been deleted or does not exist, causing operations on the alias to fail.

generic

中文

别名被配置为引用一个已被删除或不存在的索引,导致对别名的操作失败。

Official Documentation

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-add-alias.html

Workarounds

  1. 95% success Update the alias to point to an existing index: POST _aliases { "actions": [ { "remove": { "index": "logs-2025.03", "alias": "logs_current" } }, { "add": { "index": "logs-2025.04", "alias": "logs_current" } } ] }
    Update the alias to point to an existing index: POST _aliases { "actions": [ { "remove": { "index": "logs-2025.03", "alias": "logs_current" } }, { "add": { "index": "logs-2025.04", "alias": "logs_current" } } ] }
  2. 85% success If the index was accidentally deleted, restore it from a snapshot: POST _snapshot/my_repo/snapshot_2025/_restore { "indices": "logs-2025.03", "rename_pattern": "logs-2025.03", "rename_replacement": "logs-2025.03" }
    If the index was accidentally deleted, restore it from a snapshot: POST _snapshot/my_repo/snapshot_2025/_restore { "indices": "logs-2025.03", "rename_pattern": "logs-2025.03", "rename_replacement": "logs-2025.03" }

中文步骤

  1. 更新别名指向现有索引:POST _aliases { "actions": [ { "remove": { "index": "logs-2025.03", "alias": "logs_current" } }, { "add": { "index": "logs-2025.04", "alias": "logs_current" } } ] }
  2. 如果索引被意外删除,从快照恢复:POST _snapshot/my_repo/snapshot_2025/_restore { "indices": "logs-2025.03", "rename_pattern": "logs-2025.03", "rename_replacement": "logs-2025.03" }

Dead Ends

Common approaches that don't work:

  1. 70% fail

    If the mapping does not match the expected schema, the alias may work but queries fail; also, data from the original index is lost

  2. 95% fail

    The alias still references the missing index; it must be updated to point to an existing index