在domain上指定settings
@Document(indexName = "myindex", type = "mylog", shards = 1, replicas = 1)
@Setting(settingPath = "elasticsearch/settings.json")
public class MyLog {
//...
}
在resources文件夹下建立指定的配置
src/main/resources/elasticsearch/settings.json
{
"index": {
"action.write_consistency" : "all"
}
}
测试
@Test
public void reCreateIndex() {
elasticsearchTemplate.deleteIndex(MyLog.class);
elasticsearchTemplate.createIndex(MyLog.class);
}
查看
curl -XGET 192.168.99.100:9200/myindex/_settings