Failing ElasticSearch migration

If ElasticSearch indices have been created with an invalid name, the ElasticSearch migration will fail with the following error:

Bash
2026-Feb-18 12:39:57 PM [main] ERROR com.veridiumid.persistence.migration.Main 
co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/indices.create] failed: [invalid_alias_name_exception] 
Invalid alias name [ELK_KEYSPACE.ELK_INDEXNAME]: an index or data stream exists with the same name as the alias
java.lang.RuntimeException: co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/indices.create] 
failed: [invalid_alias_name_exception] Invalid alias name [ELK_KEYSPACE.ELK_INDEXNAME]: an index or data stream exists 
with the same name as the alias

Resolution:

Delete the incorrectly named indices and re-run the migration. This can happen for identity_deprovision and dormant_device

To delete the indices run the following command:

Bash
## take index name:
eops -l | grep dormant_device
eops -l | grep identity-deprovision

eops -x=DELETE -p=/veridium.dormant_device
eops -x=DELETE -p=/veridium.identity-deprovision

##create index with proper templates:
bash /opt/veridiumid/migration/bin/elk_ops.sh --update-settings

## migrate data
/opt/veridiumid/migration/bin/migrate_to_elk.sh -x
/opt/veridiumid/migration/bin/migrate_to_elk.sh -y

To re-run the migration you can use the following commands:

This is the proper fix, delivered in 3.9, but can be applied after the update of 3.8.4:

###elasticsearch/index-templates.json
## modify rollover_alias to be identity_deprovision instead of identity-deprovision
## modify rollover_alias to be dormant_device instead of dormant-device

###elasticsearch/lifecycle-policies.json
##modify the policy	for these 2:
        {
            "policyName": "identity-deprovision-policy",
            "content": {
                "policy": {
                    "phases": {
                        "hot": {
                            "actions": {
                                "rollover": {
                                    "max_primary_shard_size": "50gb"
                                }
                            }
                        }
                    }
                }
            }
        },

        {
            "policyName": "dormant-device-policy",
            "content": {
                "policy": {
                    "phases": {
                        "hot": {
                            "actions": {
                                "rollover": {
                                    "max_primary_shard_size": "50gb"
                                }
                            }
                        }
                    }
                }
            }
        },

## delete index:

eops -l | grep dormant_device
eops -l | grep identity-deprovision

eops -x=DELETE -p=/veridium.identity_deprovision
eops -x=DELETE -p=/veridium.dormant_device

## create proper indexes format:
/opt/veridiumid/migration/bin/elk_ops.sh --update-settings

##migrate data:
/opt/veridiumid/migration/bin/migrate_to_elk.sh -x
/opt/veridiumid/migration/bin/migrate_to_elk.sh -y


## check - there should be no errors
eops -x=GET -p=/veridium.identity_deprovision-000001/_ilm/explain
eops -x=GET -p=/veridium.dormant_device-000001/_ilm/explain

Last updated: