如何设置index.routing.allocation

时间:2016-09-01 11:10:57

标签: elasticsearch elasticsearch-java-api

我如何设置index.routing.allocation.*设置,例如:

PUT test/_settings
{
  "index.routing.allocation.include.size": "big,medium"
}

对于带有Java API的test索引?

1 个答案:

答案 0 :(得分:0)

试试这段代码:

Settings settings = Settings.settingsBuilder()
.put("index.routing.allocation.include.size", "big,medium")
.build();

client.admin().indices().prepareCreate("test")
.setSettings(settings)
.execute().actionGet()