diff --git a/pom.xml b/pom.xml
index 9ea978e883bc9b7c3815488590b59f0a587ca288..78b46d208f5723bd07d7a878ac535f351c6d76d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
2.6
4.0.1
3.2.7.RELEASE
- 6.8.8
+ 7.8.0
1.2.2
zlt-job/**/*, zlt-register/**/*, zlt-web/**/*
openjdk:8-jre-alpine
diff --git a/zlt-business/search-center/search-server/src/main/java/com/central/admin/service/impl/IndexServiceImpl.java b/zlt-business/search-center/search-server/src/main/java/com/central/admin/service/impl/IndexServiceImpl.java
index 3639c7a2ba019c59394f047c66183a0b1a3e8604..08790812c8b59ba595b2942b145ba1e73a82abdd 100644
--- a/zlt-business/search-center/search-server/src/main/java/com/central/admin/service/impl/IndexServiceImpl.java
+++ b/zlt-business/search-center/search-server/src/main/java/com/central/admin/service/impl/IndexServiceImpl.java
@@ -2,50 +2,50 @@ package com.central.admin.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
-import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.central.admin.model.IndexDto;
import com.central.admin.service.IIndexService;
import com.central.common.model.PageResult;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.util.EntityUtils;
-import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
-import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
+import org.elasticsearch.client.indices.CreateIndexRequest;
+import org.elasticsearch.client.indices.CreateIndexResponse;
+import org.elasticsearch.client.indices.GetIndexRequest;
+import org.elasticsearch.client.indices.GetIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
-import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
-import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
-import org.elasticsearch.cluster.metadata.AliasMetaData;
-import org.elasticsearch.cluster.metadata.MappingMetaData;
-import org.elasticsearch.common.collect.ImmutableOpenMap;
+import org.elasticsearch.cluster.metadata.AliasMetadata;
+import org.elasticsearch.cluster.metadata.MappingMetadata;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.stereotype.Service;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 索引
*
* @author zlt
* @date 2019/4/23
+ *
+ * Blog: https://zlt2000.gitee.io
+ * Github: https://github.com/zlt2000
*/
@Service
public class IndexServiceImpl implements IIndexService {
- @Autowired
- private ElasticsearchRestTemplate elasticsearchRestTemplate;
-
private ObjectMapper mapper = new ObjectMapper();
+ private final ElasticsearchRestTemplate elasticsearchRestTemplate;
+
+ public IndexServiceImpl(ElasticsearchRestTemplate elasticsearchRestTemplate) {
+ this.elasticsearchRestTemplate = elasticsearchRestTemplate;
+ }
+
@Override
public boolean create(IndexDto indexDto) throws IOException {
CreateIndexRequest request = new CreateIndexRequest(indexDto.getIndexName());
@@ -53,9 +53,9 @@ public class IndexServiceImpl implements IIndexService {
.put("index.number_of_shards", indexDto.getNumberOfShards())
.put("index.number_of_replicas", indexDto.getNumberOfReplicas())
);
- if (StrUtil.isNotEmpty(indexDto.getType()) && StrUtil.isNotEmpty(indexDto.getMappingsSource())) {
+ if (StrUtil.isNotEmpty(indexDto.getMappingsSource())) {
//mappings
- request.mapping(indexDto.getType(), indexDto.getMappingsSource(), XContentType.JSON);
+ request.mapping(indexDto.getMappingsSource(), XContentType.JSON);
}
CreateIndexResponse response = elasticsearchRestTemplate.getClient()
.indices()
@@ -87,24 +87,14 @@ public class IndexServiceImpl implements IIndexService {
return PageResult.