How to change numer of shards and put mapping before bulk operation using java api?

Hi guys,

I'm using BulkRequestBuilder api to create index in bulk, but I want to
change default number of shards and put mapping for the index, who can tell
me which api should I choose?

My bulk code is attached:
XContentBuilder xb = json string;
bulkRequest.add(client.prepareIndex("test","kba", id).setSource(xb));
*
*
I have tried the following api to change number of shards, but it will
result some exception.
client.admin().indices().prepareCreate("trec")
.setSettings(ImmutableSettings.settingsBuilder().put("number_of_shards",
10).put("number_of_replicas", "1"))
.execute().actionGet();

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

try "index.number_of_shards" and "index.number_of_replicas" instead.

simon

On Thursday, March 7, 2013 1:13:56 PM UTC+1, Jingang Wang wrote:

Hi guys,

I'm using BulkRequestBuilder api to create index in bulk, but I want to
change default number of shards and put mapping for the index, who can tell
me which api should I choose?

My bulk code is attached:
XContentBuilder xb = json string;
bulkRequest.add(client.prepareIndex("test","kba", id).setSource(xb));
*
*
I have tried the following api to change number of shards, but it will
result some exception.
client.admin().indices().prepareCreate("trec")
.setSettings(ImmutableSettings.settingsBuilder().put("number_of_shards",
10).put("number_of_replicas", "1"))
.execute().actionGet();

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks for your reply.
I have resolved this problem.

On Thursday, March 7, 2013 9:33:58 PM UTC+8, simonw wrote:

try "index.number_of_shards" and "index.number_of_replicas" instead.

simon

On Thursday, March 7, 2013 1:13:56 PM UTC+1, Jingang Wang wrote:

Hi guys,

I'm using BulkRequestBuilder api to create index in bulk, but I want to
change default number of shards and put mapping for the index, who can tell
me which api should I choose?

My bulk code is attached:
XContentBuilder xb = json string;
bulkRequest.add(client.prepareIndex("test","kba", id).setSource(xb));
*
*
I have tried the following api to change number of shards, but it will
result some exception.
client.admin().indices().prepareCreate("trec")
.setSettings(ImmutableSettings.settingsBuilder().put("number_of_shards",
10).put("number_of_replicas", "1"))
.execute().actionGet();

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.