From 922d121e1e6bf896db676c61fc557e088abd392e Mon Sep 17 00:00:00 2001 From: jaime Date: Fri, 28 Feb 2025 17:06:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=E6=80=A7=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../easyes/common/property/EasyEsProperties.java | 4 ++++ .../dromara/easyes/common/utils/EsClientUtils.java | 6 ++++-- .../org/dromara/easyes/test/entity/Document.java | 2 +- .../java/org/dromara/easyes/test/all/AllTest.java | 2 +- easy-es-solon-test/src/test/resources/app.yml | 12 ++++++------ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/easy-es-common/src/main/java/org/dromara/easyes/common/property/EasyEsProperties.java b/easy-es-common/src/main/java/org/dromara/easyes/common/property/EasyEsProperties.java index 8bb20cca..dbf7da07 100644 --- a/easy-es-common/src/main/java/org/dromara/easyes/common/property/EasyEsProperties.java +++ b/easy-es-common/src/main/java/org/dromara/easyes/common/property/EasyEsProperties.java @@ -19,6 +19,10 @@ public class EasyEsProperties { * 是否开启easy-es LOGO BANNER的打印 */ private boolean banner = true; + /** + * 是否开启兼容性(超低版本的es, 比如7.0.0开启该特性) + */ + private boolean compatible = false; /** * es client address es客户端地址 */ diff --git a/easy-es-common/src/main/java/org/dromara/easyes/common/utils/EsClientUtils.java b/easy-es-common/src/main/java/org/dromara/easyes/common/utils/EsClientUtils.java index bf70056c..c7004b0e 100644 --- a/easy-es-common/src/main/java/org/dromara/easyes/common/utils/EsClientUtils.java +++ b/easy-es-common/src/main/java/org/dromara/easyes/common/utils/EsClientUtils.java @@ -112,8 +112,10 @@ public class EsClientUtils { throw ExceptionUtils.eee(e); } } - // - buildCompatible(httpClientBuilder); + // 兼容性配置 + if (easyEsConfigProperties.isCompatible()) { + buildCompatible(httpClientBuilder); + } return httpClientBuilder; }); diff --git a/easy-es-solon-test/src/main/java/org/dromara/easyes/test/entity/Document.java b/easy-es-solon-test/src/main/java/org/dromara/easyes/test/entity/Document.java index cd8943e0..c5f5ce96 100644 --- a/easy-es-solon-test/src/main/java/org/dromara/easyes/test/entity/Document.java +++ b/easy-es-solon-test/src/main/java/org/dromara/easyes/test/entity/Document.java @@ -155,6 +155,6 @@ public class Document extends BaseJoin { /** * 稠密向量类型,dims 非负 最大为2048 */ - @IndexField(fieldType = FieldType.DENSE_VECTOR) + @IndexField(fieldType = FieldType.DENSE_VECTOR, dims = 3) private double[] vector; } diff --git a/easy-es-solon-test/src/test/java/org/dromara/easyes/test/all/AllTest.java b/easy-es-solon-test/src/test/java/org/dromara/easyes/test/all/AllTest.java index f84e85b3..1ac51b89 100644 --- a/easy-es-solon-test/src/test/java/org/dromara/easyes/test/all/AllTest.java +++ b/easy-es-solon-test/src/test/java/org/dromara/easyes/test/all/AllTest.java @@ -187,7 +187,7 @@ public class AllTest { @Order(8) public void testSQL() { // 注意 sql中的from后面跟的是要被查询的索引名,也可以是索引别名(效果一样) 由于索引名可能会变,所以此处我采用别名ee_default_alias进行查询 - String sql = "select count(*) from ee_default_alias where star_num > 0"; + String sql = "select count(*) from ee_default_alias where starNum > 0"; String jsonResult = documentMapper.executeSQL(sql); System.out.println(jsonResult); Assertions.assertNotNull(jsonResult); diff --git a/easy-es-solon-test/src/test/resources/app.yml b/easy-es-solon-test/src/test/resources/app.yml index e94bc550..38c3de80 100644 --- a/easy-es-solon-test/src/test/resources/app.yml +++ b/easy-es-solon-test/src/test/resources/app.yml @@ -1,9 +1,9 @@ easy-es: # enable: true address: 127.0.0.1:9200 - # schema: http -# username: elastic -# password: mg123456 + schema: https + username: elastic + password: a2*HFkQU93mBnxOTaEAs keep-alive-millis: 18000 global-config: i-kun-mode: false @@ -26,6 +26,6 @@ easy-es: #username: '若无可去掉此行' #password: '若无可去掉此行' -#logging: -# level: -# tracer: trace \ No newline at end of file +logging: + level: + tracer: trace \ No newline at end of file