elasticsearch javaapi设置主副片

用curl命令curl -XPUT localhost:9200/{cluster} -d'{"settings":{"number_of_shards":4,"number_of_replicas":0}}'可以设置主副片,如果在java代码里设置,api应该怎么调用
已邀请:

minsa

赞同来自:

elasticsearch版本5.3

luoningsun - 90后

赞同来自:

client.admin().indices().prepareCreate("twitter") .setSettings(Settings.builder() .put("index.number_of_shards", 3) .put("index.number_of_replicas", 2) ) .get();
 
官网说明:https://www.elastic.co/guide/e ... .html

要回复问题请先登录注册