From 5912120222d95a063819958d2b0efacee2741e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Thu, 9 Mar 2023 17:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91JeroElasticsearchT?= =?UTF-8?q?emplate=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/es/JeroElasticsearchTemplate.java | 70 ------------------- 1 file changed, 70 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/es/JeroElasticsearchTemplate.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/es/JeroElasticsearchTemplate.java index 90758d7b..cc3db9a6 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/es/JeroElasticsearchTemplate.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/es/JeroElasticsearchTemplate.java @@ -156,13 +156,6 @@ public class JeroElasticsearchTemplate { public boolean createIndex(String indexName) { String url = this.getBaseUrl(indexName).toString(); - /* 返回结果 (仅供参考) - "createIndex": { - "shards_acknowledged": true, - "acknowledged": true, - "index": "hello_world" - } - */ try { return RestUtil.put(url).getBoolean("acknowledged"); } catch (org.springframework.web.client.HttpClientErrorException ex) { @@ -210,36 +203,6 @@ public class JeroElasticsearchTemplate { url += "&include_type_name=true"; } log.info("getIndexMapping-url:" + url); - /* - * 参考返回JSON结构: - * - *{ - * // 索引名称 - * "[indexName]": { - * "mappings": { - * // 分类名称 - * "[typeName]": { - * "properties": { - * // 字段名 - * "input_number": { - * // 字段类型 - * "type": "long" - * }, - * "input_string": { - * "type": "text", - * "fields": { - * "keyword": { - * "type": "keyword", - * "ignore_above": 256 - * } - * } - * } - * } - * } - * } - * } - * } - */ try { return RestUtil.get(url); } catch (org.springframework.web.client.HttpClientErrorException e) { @@ -304,22 +267,6 @@ public class JeroElasticsearchTemplate { */ public boolean saveOrUpdate(String indexName, String typeName, String dataId, JSONObject data) { String url = this.getBaseUrl(indexName, typeName).append("/").append(dataId).append("?refresh=wait_for").toString(); - /* 返回结果(仅供参考) - "createIndexA2": { - "result": "created", - "_shards": { - "total": 2, - "successful": 1, - "failed": 0 - }, - "_seq_no": 0, - "_index": "test_index_1", - "_type": "test_type_1", - "_id": "a2", - "_version": 1, - "_primary_term": 1 - } - */ try { // 去掉 data 中为空的值 @@ -368,7 +315,6 @@ public class JeroElasticsearchTemplate { JSONObject data = dataList.getJSONObject(i); String id = data.getString("id"); // 该行的操作 - // {"create": {"_id":"${id}", "_index": "${indexName}", "_type": "${typeName}"}} JSONObject action = new JSONObject(); JSONObject actionInfo = new JSONObject(); actionInfo.put("_id", id); @@ -393,22 +339,6 @@ public class JeroElasticsearchTemplate { */ public boolean delete(String indexName, String typeName, String dataId) { String url = this.getBaseUrl(indexName, typeName).append("/").append(dataId).toString(); - /* 返回结果(仅供参考) - { - "_index": "es_demo", - "_type": "docs", - "_id": "001", - "_version": 3, - "result": "deleted", - "_shards": { - "total": 1, - "successful": 1, - "failed": 0 - }, - "_seq_no": 28, - "_primary_term": 18 - } - */ try { return "deleted".equals(RestUtil.delete(url).getString("result")); } catch (org.springframework.web.client.HttpClientErrorException ex) {