Search code examples
elasticsearchkibana

Elasticsearch index crashes


When the delete phase policy must delete the last index, it does not delete it and also adds the alias again. I look at the aliases and i see clearly that it creates an alias conflict and my current index is blocked

GET _aliases

  "index-000113" : {
    "aliases" : {
      "index" : { }
    }
  },
  "index-000114" : {
    "aliases" : { }
  },
  "index-000115" : {
    "aliases" : { }
  },
  "index-000116" : {
    "aliases" : {
      "index" : { }
    }
  },

My configuration have 3 nodes , 1 master and 2 slaves. My solution is to manually delete the index that should be deleted by the deletion policy

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

My last shard Activity in kibana

index-000113
Shard: 0 / Replica Recovery type: Peer Done (node01 > node03)

index-000113
Shard: 0 / Primary Recovery type: Existing_store Done (n/a > node03)

It seems that the last activity has something to do with it that I don't know what it means. anyone know why it happens and any solution?

I looked in the official documentation but i can't find why happens.


Solution

  • The _aliases API remove action is not remove the index but alias. To remove the index you can use remove_index action.

    add - Adds a data stream or index to an alias. If the alias doesn’t exist, the add action creates it.
    remove -  Removes a data stream or index from an alias.
    remove_index - Deletes an index. You cannot use this action on aliases or data streams.
    

    check the followings:

    1. Check ILM policy GET _ilm/policy/<policy_id>
    2. Use explain index ILM policy API GET <index_name>/_ilm/explain
    3. Test the rollover with dry_run POST <index_pattern>/_rollover?dry_run=true your index pattern is index.

    The alias named index looks like your write_alias. When the index rolled over the alias must be switch to the latest index. If not try to add is_write_index: true to the index template. If you stuck again create another rollover index and start from scratch.