Skip to content
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

Special characters allowed for aliases which are not allowed in index names #20748

Closed
robin13 opened this issue Oct 5, 2016 · 0 comments
Closed
Assignees
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates

Comments

@robin13
Copy link
Contributor

robin13 commented Oct 5, 2016

Elasticsearch version: 5.0.0-alpha5

Plugins installed: [] x-pack

JVM version:1.8.0_101

OS version: Ubuntu 14.04

Description of the problem including expected versus actual behavior:

Steps to reproduce:

It is possible to use special characters, e.g. * in aliases which are not allowed in Index names. I think this is a bug as it can lead to very confusing states - below is an example:

PUT /foo
PUT /bar

# This will fail with invalid_index_name_exception
PUT /foo*

PUT /foo/bar/1
{
  "message": "Indexed into /foo/bar/1"
}

PUT /bar/bar/1
{
  "message":"Idexed into /bar/bar/1"
}

# This will fail� with invalid_index_name_exception
PUT /bar*/bar/2
{
  "message":"Indexed into /bar*/bar/2"
}

POST /_aliases
{
  "actions":[
    {"add": { "index": "foo", "alias":"bar*" } }
    ]
}

# Now this will be successful - confusing!
PUT /bar*/bar/2
{
  "message":"Indexed into /bar*/bar/2"
}

# A search on indexes /bar* responds with results both from the index `bar` and from `foo` as a result of the alias.
GET /bar*/_search
{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 10,
    "successful": 10,
    "failed": 0
  },
  "hits": {
    "total": 3,
    "max_score": 1,
    "hits": [
      {
        "_index": "foo",
        "_type": "bar",
        "_id": "2",
        "_score": 1,
        "_source": {
          "message": "Indexed into /bar*/bar/2"
        }
      },
      {
        "_index": "bar",
        "_type": "bar",
        "_id": "1",
        "_score": 1,
        "_source": {
          "message": "Idexed into /bar/bar/1"
        }
      },
      {
        "_index": "foo",
        "_type": "bar",
        "_id": "1",
        "_score": 1,
        "_source": {
          "message": "Indexed into /foo/bar/1"
        }
      }
    ]
  }
}
@nik9000 nik9000 self-assigned this Oct 5, 2016
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Nov 8, 2016
Applied (almost) the same rules we use to validate index names
to new alias names. The only rule not applies it "must be lowercase".
We have tests that don't follow that rule and I except there are lots
of examples of camelCase alias names in the wild. We can add that
validation but I'm not sure it is worth it.

Closes elastic#20748

Adds an alias that starts with `#` to the BWC index and validates
that you can read from it and remove it. Starting with `#` isn't
allowed after 5.1.0/6.0.0 so we don't create the alias or check it
after those versions.
nik9000 added a commit that referenced this issue Nov 8, 2016
Applied (almost) the same rules we use to validate index names
to new alias names. The only rule not applies it "must be lowercase".
We have tests that don't follow that rule and I except there are lots
of examples of camelCase alias names in the wild. We can add that
validation but I'm not sure it is worth it.

Closes #20748

Adds an alias that starts with `#` to the BWC index and validates
that you can read from it and remove it. Starting with `#` isn't
allowed after 5.1.0/6.0.0 so we don't create the alias or check it
after those versions.
@clintongormley clintongormley added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Aliases labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates
Projects
None yet
Development

No branches or pull requests

3 participants