Search code examples
elasticsearchkibana

Delete index by alias name


With Elasticsearch, I can delete an index by its name:

DELETE my_index
{}

But I can not delete it by its alias name:

DELETE my_index_alias
{}

Error is:

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

Is there a way to delete an index by its alias name?


Solution

  • I believe the thing you are trying to achieve is not possible. Currently, ElasticSearch DELETE API supports the following :

    1. You may either delete an index

    curl -XDELETE 'http://localhost:9200/{indexname}'

    deletes {indexname} if and only if {indexname} is a concrete index.

    or 2. Delete the alias instead

    curl -XDELETE 'http://localhost:9200/_alias/{aliasname}'

    deletes {aliasname} if and only if {aliasname} is an index alias.