elasticsearch/elasticsearch — Issue #1695: Creating an index and alias in the same request
Author: dadoonet
Created: 2012-02-12 13:58:18+00:00
State: open

Hi,

As discussed in the mailing list, here is a feature request.

I would like to be able to define an alias for an index while I'm creating the index.

```
curl -XPUT http://localhost:9200/twitter/ -d '
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2
},
"alias": [
"myalias"
]
}
'
```

It would be nice to have in the Java API also :

```java
CreateIndexRequestBuilder cirb = client.admin().indices().prepareCreate(index);
cirb.setSettings(source);
// New method here
cirb.setAlias("myalias");
cirb.execute().actionGet();
```

Here is the signature expected for setAlias method : ```setAlias(String... alias)```

Discussion here : https://groups.google.com/group/elasticsearch/browse_thread/thread/f60bff3fda0f93dc?hl=fr