Index and Alias name exact name

Hi,

An index and alias with the exact same name was accidently created and now our Elasticsearch node won't connect to our cluster. Luckily only 1 node was restarted before we read a support article saying DO NOT restart any nodes. I am hoping someone here can help me resolve before Elastic support reply (4 hours SLA).

Hoping this post will help people in the future. Couldn't find anything similar in the forum.

I have tried

POST /_aliases
{
  "actions": [
    {
      "remove": {
        "index": "*",
        "alias": "q_mqtt_devices"
      }
    }
  ]
}

and this results in

{
  "error": {
    "root_cause": [
      {
        "type": "aliases_not_found_exception",
        "reason": "aliases [q_mqtt_devices] missing",
        "resource.type": "aliases",
        "resource.id": "q_mqtt_devices"
      }
    ],
    "type": "aliases_not_found_exception",
    "reason": "aliases [q_mqtt_devices] missing",
    "resource.type": "aliases",
    "resource.id": "q_mqtt_devices"
  },
  "status": 404
}

Trying this also

DELETE q_mqtt_devices/_alias/q_mqtt_devices

Results in

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "The provided expression [q_mqtt_devices] matches an alias, specify the corresponding concrete indices instead."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "The provided expression [q_mqtt_devices] matches an alias, specify the corresponding concrete indices instead."
  },
  "status": 400
}

What version of Elasticsearch are you using? You should always state this as the answer may depend on version.

Have you tried removing the alias the same way you added it:

POST _aliases
{
  "actions": [
    {
      "remove": {
        "index": "q_mqtt_devices",
        "alias": "q_mqtt_devices"
      }
    }
  ]
}

Tried this but this has not worked. Running 8.5.0

OK, then I suspect support may need to get involved. The fact that using a wildcard for index name when creating an alias allows an alias with the same name as an existing index to be created sounds like a validation bug, so I would recommend opening an issue on Github to fix this.

This is a known issue in 8.5.0 and an upgrade to 8.5.3 will fix it:

2 Likes

Thank you again David

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.