Set shards and replicas when creating index?

Hi,

I have some Java code that creates an index using CreateIndexRequest.

I would like to specify the number of shards and replicas per shard
when I create the index, however I cannot see any way to set these
properties on CreateIndexRequest.

I do see a generic "settings" property, but there is no documentation
in the Javadocs to tell me what the valid settings are, so I have no
way of knowing what to put here.

Can someone help me out?

Thanks,
Frank

Is this the right way?

CreateIndexRequest createRequest = new CreateIndexRequest(INDEX_NAME);
Settings indexSettings =
ImmutableSettings.settingsBuilder().put("number_of_shards",
NUMBER_OF_SHARDS).put("number_of_replicas",
NUMBER_OF_REPLICAS).build();
createRequest.settings(indexSettings);

On Feb 21, 10:48 am, Frank LaRosa fr...@studyblue.com wrote:

Hi,

I have some Java code that creates an index using CreateIndexRequest.

I would like to specify the number of shards and replicas per shard
when I create the index, however I cannot see any way to set these
properties on CreateIndexRequest.

I do see a generic "settings" property, but there is no documentation
in the Javadocs to tell me what the valid settings are, so I have no
way of knowing what to put here.

Can someone help me out?

Thanks,
Frank

On Tue, 2012-02-21 at 08:48 -0800, Frank LaRosa wrote:

Hi,

I have some Java code that creates an index using CreateIndexRequest.

I would like to specify the number of shards and replicas per shard
when I create the index, however I cannot see any way to set these
properties on CreateIndexRequest.

I do see a generic "settings" property, but there is no documentation
in the Javadocs to tell me what the valid settings are, so I have no
way of knowing what to put here.

Have a look at
Elasticsearch Platform — Find real-time answers at scale | Elastic plus the
other pages linked to in the right column menu

clint

Yes, this will work.

On Tuesday, February 21, 2012 at 6:54 PM, Frank LaRosa wrote:

Is this the right way?

CreateIndexRequest createRequest = new CreateIndexRequest(INDEX_NAME);
Settings indexSettings =
ImmutableSettings.settingsBuilder().put("number_of_shards",
NUMBER_OF_SHARDS).put("number_of_replicas",
NUMBER_OF_REPLICAS).build();
createRequest.settings(indexSettings);

On Feb 21, 10:48 am, Frank LaRosa <fr...@studyblue.com (http://studyblue.com)> wrote:

Hi,

I have some Java code that creates an index using CreateIndexRequest.

I would like to specify the number of shards and replicas per shard
when I create the index, however I cannot see any way to set these
properties on CreateIndexRequest.

I do see a generic "settings" property, but there is no documentation
in the Javadocs to tell me what the valid settings are, so I have no
way of knowing what to put here.

Can someone help me out?

Thanks,
Frank