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

Support 'aliases' option on indices.create #13

Closed
labrown opened this issue Feb 3, 2014 · 2 comments
Closed

Support 'aliases' option on indices.create #13

labrown opened this issue Feb 3, 2014 · 2 comments

Comments

@labrown
Copy link

labrown commented Feb 3, 2014

This works on elasticsearch 0.90.7 to create an alias at the same time an index is created.

curl -XPUT "https://localhost/foo/" -d'
{
aliases: [ "foo-alias" ]
}'

It would be nice to have this in the Perl API as well.

@clintongormley
Copy link
Contributor

Hi @labrown

You can already do this. Anything in the request body should be passed in the body parameter:

$e->indices->create(index=>'foo', body=>{ aliases=>['foo-alias']})

But beware... adding aliases at index creation time is not currently supported. In fact, we weren't aware that this would work at all. There's a PR open at the moment to add this exact functionality: elastic/elasticsearch#4920

I've played around with this and found that combining aliases with settings doesn't set the aliases:

curl -XPUT "http://localhost:9200/foo/" -d'
{
  "aliases": [
    "foo-alias"
  ],
  "settings": {
    "number_of_shards": 1
  }
}'

But, including it in the settings DOES work:

curl -XPUT "http://localhost:9200/foo/" -d'
{
  "settings": {
    "number_of_shards": 1,
    "aliases": [
      "foo-alias"
    ]
  }
}'

@labrown
Copy link
Author

labrown commented Feb 4, 2014

Interesting. Thanks for letting me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants