Skip to content

Create an index with the same name as an alias results in illegal_argument_exception for any action #92078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
salvob41 opened this issue Dec 4, 2022 · 2 comments
Labels
>bug needs:triage Requires assignment of a team area label

Comments

@salvob41
Copy link

salvob41 commented Dec 4, 2022

Elasticsearch Version

v8.5

Installed Plugins

No response

Java Version

bundled

OS Version

any

Problem Description

You could create a a elasticsearch index with the same name of an alias without error. But this will result in a state in which you cannot make any actions on said index. In fact an action like

DELETE <index>

will result in...

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

Restarting the node will not be succesfull, and there will be the following error:

2022-12-04 15:41:49 {"@timestamp":"2022-12-04T14:41:49.675Z", "log.level":"ERROR", "message":"fatal exception while booting Elasticsearch", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"9c6f45711d60","elasticsearch.cluster.name":"docker-cluster","error.type":"java.lang.IllegalStateException","error.message":"index, alias, and data stream names need to be unique, but the following duplicates were found [mydata (alias of [mydata/1Y69sJxZT1qIkKnM-w4ERA]) conflicts with index]","error.stack_trace":"java.lang.IllegalStateException: index, alias, and data stream names need to be unique, but the following duplicates were found [mydata (alias of [mydata/1Y69sJxZT1qIkKnM-w4ERA]) conflicts with index]\n\tat [email protected]/org.elasticsearch.cluster.metadata.Metadata$Builder.ensureNoNameCollisions(Metadata.java:2225)\n\tat [email protected]/org.elasticsearch.cluster.metadata.Metadata$Builder.build(Metadata.java:2135)\n\tat [email protected]/org.elasticsearch.cluster.metadata.Metadata$Builder.build(Metadata.java:2071)\n\tat [email protected]/org.elasticsearch.gateway.PersistedClusterStateService.loadOnDiskState(PersistedClusterStateService.java:618)\n\tat [email protected]/org.elasticsearch.gateway.PersistedClusterStateService.loadBestOnDiskState(PersistedClusterStateService.java:465)\n\tat [email protected]/org.elasticsearch.gateway.PersistedClusterStateService.loadBestOnDiskState(PersistedClusterStateService.java:380)\n\tat [email protected]/org.elasticsearch.gateway.GatewayMetaState.start(GatewayMetaState.java:101)\n\tat [email protected]/org.elasticsearch.node.Node.start(Node.java:1294)\n\tat [email protected]/org.elasticsearch.bootstrap.Elasticsearch.start(Elasticsearch.java:436)\n\tat [email protected]/org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:229)\n\tat [email protected]/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)\n"}

Steps to Reproduce

In order to reproduce you could create an index_template containing an alias

such as (... from the docs):

PUT _index_template/template_1
{
  "index_patterns": ["te*", "bar*"],
  "template": {
    "settings": {
      "number_of_shards": 1
    },
    "mappings": {
      "_source": {
        "enabled": true
      },
      "properties": {
        "host_name": {
          "type": "keyword"
        },
        "created_at": {
          "type": "date",
          "format": "EEE MMM dd HH:mm:ss Z yyyy"
        }
      }
    },
    "aliases": {
      "mydata": { }
    }
  },
  "priority": 500,
  "composed_of": ["component_template1", "runtime_component_template"], 
  "version": 3,
  "_meta": {
    "description": "my custom"
  }
}

and then if you create a index with the same name of the alias such as:

PUT /mydata

It will create correctly the index.

but then no operation is permitted on the index

Logs (if relevant)

No response

@salvob41 salvob41 added >bug needs:triage Requires assignment of a team area label labels Dec 4, 2022
@salvob41
Copy link
Author

salvob41 commented Dec 4, 2022

well. I was just sperimenting with this.

And I realised that while this is true for v8.5.0, it does not allow me to create a index with the same template name in v8.5.2.

So I guess this is fixed in v8.5.2 :)

Thank you, in advance.

I could not find anything related to this kind of issue on the backlog :D

@DaveCTurner
Copy link
Contributor

Yes this was fixed in 8.5.1 by #91456 - closing this as a duplicate.

@DaveCTurner DaveCTurner closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug needs:triage Requires assignment of a team area label
Projects
None yet
Development

No branches or pull requests

2 participants