user11081980
user11081980

Reputation: 3289

Removing an index from an alias in Elasticsearch

How can we remove an index from an alias? That is, I no longer need to associate an index to an alias.

My second question is - can an alias exist without any indexes?

Upvotes: 18

Views: 30684

Answers (3)

Fabien Haddadi
Fabien Haddadi

Reputation: 2080

You can run following in elasticsearch dev tools console

DELETE /<your_index>/_alias/<unwanted_alias_to_be_removed>

Upvotes: 4

Jay Shah
Jay Shah

Reputation: 3771

In case you don't know the name of index and you want to remove alias from all indexes

Post: /_aliases
{
 "actions" : [
    { "remove" : { "index" : "*", "alias" : "nameOfAlias" } }
 ]
}

Upvotes: 27

Andrei Stefan
Andrei Stefan

Reputation: 52366

Add an alias:

POST _aliases
{
  "actions": [
    {
      "add": {
        "index": ".marvel-2015.06.05",
        "alias": "alias1"
      }
    },
    {
      "add": {
        "index": ".marvel-2015.06.04",
        "alias": "alias1"
      }
    }
  ]
}

List the alias:

GET /alias1/_alias

Remove one index:

POST _aliases
{
  "actions": [
    {
      "remove": {
        "index": ".marvel-2015.06.05",
        "alias": "alias1"
      }
    }
  ]
}

And "no", an alias cannot exists without indices: https://github.com/elastic/elasticsearch/issues/7864

Upvotes: 19

Related Questions