Commit bf226020 by xmh

修改分片数量为1

1 parent 4b035ef8
...@@ -16,6 +16,7 @@ import org.elasticsearch.client.*; ...@@ -16,6 +16,7 @@ import org.elasticsearch.client.*;
import org.elasticsearch.client.indices.CreateIndexRequest; import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse; import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.GetIndexRequest; import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
...@@ -56,6 +57,10 @@ public class PoolService { ...@@ -56,6 +57,10 @@ public class PoolService {
CreateIndexRequest createIndexRequest = new CreateIndexRequest(poolId); CreateIndexRequest createIndexRequest = new CreateIndexRequest(poolId);
XContentBuilder builder = getCreateIndexContentBuilder(); XContentBuilder builder = getCreateIndexContentBuilder();
createIndexRequest.mapping(builder); createIndexRequest.mapping(builder);
Settings.Builder setting = Settings.builder();
setting.put("index.number_of_shards", 1);
setting.put("index.number_of_replicas", 0);
createIndexRequest.settings(setting);
CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT); CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
List<Person> personPool = requestVo.getPersonPool(); List<Person> personPool = requestVo.getPersonPool();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!