From dd356c322acd604ade59d34eb2fbb291d37c969f Mon Sep 17 00:00:00 2001 From: xpc1024 <252645816@qq.com> Date: Tue, 21 Jun 2022 18:20:40 +0800 Subject: [PATCH] =?UTF-8?q?v0.9.50=201.=E8=B0=83=E6=95=B4=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E5=90=8D=E7=A7=B0=202.=E4=BF=AE=E5=A4=8D1=E5=A4=84geo?= =?UTF-8?q?Shape=E4=B8=8D=E8=83=BD=E9=80=9A=E8=BF=87shapeId=E6=A3=80?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easy-es-annotation/pom.xml | 2 +- .../{TableField.java => IndexField.java} | 2 +- .../annotation/{TableId.java => IndexId.java} | 2 +- .../{TableName.java => IndexName.java} | 2 +- easy-es-boot-starter/pom.xml | 2 +- easy-es-common/pom.xml | 2 +- easy-es-core/pom.xml | 2 +- .../cn/easyes/core/biz/EntityFieldInfo.java | 4 +-- .../core/conditions/WrapperProcessor.java | 9 +++++- .../easyes/core/toolkit/EntityInfoHelper.java | 19 ++++++------- easy-es-extension/pom.xml | 2 +- easy-es-parent/pom.xml | 2 +- easy-es-sample/pom.xml | 2 +- .../cn/easyes/sample/entity/Document.java | 24 ++++++++-------- easy-es-test/pom.xml | 2 +- .../java/cn/easyes/test/entity/Comment.java | 10 +++---- .../java/cn/easyes/test/entity/Document.java | 28 +++++++++---------- .../main/java/cn/easyes/test/entity/Faq.java | 8 +++--- .../main/java/cn/easyes/test/entity/User.java | 8 +++--- pom.xml | 2 +- 20 files changed, 70 insertions(+), 64 deletions(-) rename easy-es-annotation/src/main/java/cn/easyes/annotation/{TableField.java => IndexField.java} (98%) rename easy-es-annotation/src/main/java/cn/easyes/annotation/{TableId.java => IndexId.java} (95%) rename easy-es-annotation/src/main/java/cn/easyes/annotation/{TableName.java => IndexName.java} (98%) diff --git a/easy-es-annotation/pom.xml b/easy-es-annotation/pom.xml index 0ceb0d53..b26e8dd6 100644 --- a/easy-es-annotation/pom.xml +++ b/easy-es-annotation/pom.xml @@ -7,7 +7,7 @@ cn.easy-es easy-es-parent - 0.9.40 + 0.9.50 ../easy-es-parent diff --git a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableField.java b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexField.java similarity index 98% rename from easy-es-annotation/src/main/java/cn/easyes/annotation/TableField.java rename to easy-es-annotation/src/main/java/cn/easyes/annotation/IndexField.java index ae751c40..5d19a969 100644 --- a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableField.java +++ b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexField.java @@ -18,7 +18,7 @@ import java.lang.annotation.Target; **/ @Retention(RetentionPolicy.RUNTIME) @Target(value = {ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface TableField { +public @interface IndexField { /** * 自定义字段在es中的名称 * diff --git a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableId.java b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexId.java similarity index 95% rename from easy-es-annotation/src/main/java/cn/easyes/annotation/TableId.java rename to easy-es-annotation/src/main/java/cn/easyes/annotation/IndexId.java index 3028d96e..2c0d23e0 100644 --- a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableId.java +++ b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexId.java @@ -14,7 +14,7 @@ import java.lang.annotation.Target; **/ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) -public @interface TableId { +public @interface IndexId { /** * 字段值 * diff --git a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableName.java b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexName.java similarity index 98% rename from easy-es-annotation/src/main/java/cn/easyes/annotation/TableName.java rename to easy-es-annotation/src/main/java/cn/easyes/annotation/IndexName.java index 572b962c..ca4e2bc8 100644 --- a/easy-es-annotation/src/main/java/cn/easyes/annotation/TableName.java +++ b/easy-es-annotation/src/main/java/cn/easyes/annotation/IndexName.java @@ -16,7 +16,7 @@ import java.lang.annotation.Target; **/ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface TableName { +public @interface IndexName { /** * 实体对应的索引名 * diff --git a/easy-es-boot-starter/pom.xml b/easy-es-boot-starter/pom.xml index b2eb35a0..64a003d3 100644 --- a/easy-es-boot-starter/pom.xml +++ b/easy-es-boot-starter/pom.xml @@ -5,7 +5,7 @@ easy-es-parent cn.easy-es - 0.9.40 + 0.9.50 ../easy-es-parent 4.0.0 diff --git a/easy-es-common/pom.xml b/easy-es-common/pom.xml index 5bf97efd..c6c87767 100644 --- a/easy-es-common/pom.xml +++ b/easy-es-common/pom.xml @@ -6,7 +6,7 @@ cn.easy-es easy-es-parent - 0.9.40 + 0.9.50 ../easy-es-parent diff --git a/easy-es-core/pom.xml b/easy-es-core/pom.xml index 0e5ced8c..ca2c0311 100644 --- a/easy-es-core/pom.xml +++ b/easy-es-core/pom.xml @@ -7,7 +7,7 @@ cn.easy-es easy-es-parent - 0.9.40 + 0.9.50 ../easy-es-parent diff --git a/easy-es-core/src/main/java/cn/easyes/core/biz/EntityFieldInfo.java b/easy-es-core/src/main/java/cn/easyes/core/biz/EntityFieldInfo.java index 30a39085..b5297fe5 100644 --- a/easy-es-core/src/main/java/cn/easyes/core/biz/EntityFieldInfo.java +++ b/easy-es-core/src/main/java/cn/easyes/core/biz/EntityFieldInfo.java @@ -1,6 +1,6 @@ package cn.easyes.core.biz; -import cn.easyes.annotation.TableField; +import cn.easyes.annotation.IndexField; import cn.easyes.common.enums.FieldStrategy; import cn.easyes.common.enums.FieldType; import cn.easyes.core.config.GlobalConfig; @@ -85,7 +85,7 @@ public class EntityFieldInfo { * @param field 字段 * @param tableField 字段注解 */ - public EntityFieldInfo(GlobalConfig.DbConfig dbConfig, Field field, TableField tableField) { + public EntityFieldInfo(GlobalConfig.DbConfig dbConfig, Field field, IndexField tableField) { this.column = field.getName(); // 优先使用单个字段注解,否则使用全局配置 diff --git a/easy-es-core/src/main/java/cn/easyes/core/conditions/WrapperProcessor.java b/easy-es-core/src/main/java/cn/easyes/core/conditions/WrapperProcessor.java index fef0a5b6..3ca344f1 100644 --- a/easy-es-core/src/main/java/cn/easyes/core/conditions/WrapperProcessor.java +++ b/easy-es-core/src/main/java/cn/easyes/core/conditions/WrapperProcessor.java @@ -305,7 +305,14 @@ public class WrapperProcessor { return null; } - GeoShapeQueryBuilder builder = QueryBuilders.geoShapeQuery(geoParam.getField(), geoParam.getGeometry()); + // 构造查询参数 + GeoShapeQueryBuilder builder; + if (StringUtils.isNotBlank(geoParam.getIndexedShapeId())) { + builder = QueryBuilders.geoShapeQuery(geoParam.getField(), geoParam.getIndexedShapeId()); + } else { + builder = QueryBuilders.geoShapeQuery(geoParam.getField(), geoParam.getGeometry()); + } + Optional.ofNullable(geoParam.getShapeRelation()).ifPresent(builder::relation); Optional.ofNullable(geoParam.getBoost()).ifPresent(builder::boost); return builder; diff --git a/easy-es-core/src/main/java/cn/easyes/core/toolkit/EntityInfoHelper.java b/easy-es-core/src/main/java/cn/easyes/core/toolkit/EntityInfoHelper.java index 3af5f3ad..b6a08766 100644 --- a/easy-es-core/src/main/java/cn/easyes/core/toolkit/EntityInfoHelper.java +++ b/easy-es-core/src/main/java/cn/easyes/core/toolkit/EntityInfoHelper.java @@ -1,9 +1,9 @@ package cn.easyes.core.toolkit; import cn.easyes.annotation.HighLight; -import cn.easyes.annotation.TableField; -import cn.easyes.annotation.TableId; -import cn.easyes.annotation.TableName; +import cn.easyes.annotation.IndexField; +import cn.easyes.annotation.IndexId; +import cn.easyes.annotation.IndexName; import cn.easyes.common.enums.FieldType; import cn.easyes.common.enums.IdType; import cn.easyes.common.params.DefaultNestedClass; @@ -21,7 +21,6 @@ import com.alibaba.fastjson.parser.deserializer.ExtraProcessor; import com.alibaba.fastjson.serializer.NameFilter; import com.alibaba.fastjson.serializer.SerializeFilter; import com.alibaba.fastjson.serializer.SimplePropertyPreFilter; -import lombok.Getter; import java.lang.reflect.Field; import java.util.*; @@ -256,7 +255,7 @@ public class EntityInfoHelper { boolean hasAnnotation = false; // 初始化封装TableField注解信息 - if (field.isAnnotationPresent(TableField.class)) { + if (field.isAnnotationPresent(IndexField.class)) { initTableFieldAnnotation(dbConfig, entityInfo, field, fieldList); hasAnnotation = true; } @@ -281,7 +280,7 @@ public class EntityInfoHelper { */ private static void initTableFieldAnnotation(GlobalConfig.DbConfig dbConfig, EntityInfo entityInfo, Field field, List fieldList) { - TableField tableField = field.getAnnotation(TableField.class); + IndexField tableField = field.getAnnotation(IndexField.class); if (tableField.exist()) { // 存在字段处理 EntityFieldInfo entityFieldInfo = new EntityFieldInfo(dbConfig, field, tableField); @@ -381,7 +380,7 @@ public class EntityInfoHelper { allFields.forEach(field -> { String mappingColumn; // 处理TableField注解 - TableField tableField = field.getAnnotation(TableField.class); + IndexField tableField = field.getAnnotation(IndexField.class); if (Objects.isNull(tableField)) { mappingColumn = getMappingColumn(dbConfig, field); EntityFieldInfo entityFieldInfo = new EntityFieldInfo(dbConfig, field); @@ -464,7 +463,7 @@ public class EntityInfoHelper { */ private static boolean initTableIdWithAnnotation(GlobalConfig.DbConfig dbConfig, EntityInfo entityInfo, Field field) { - TableId tableId = field.getAnnotation(TableId.class); + IndexId tableId = field.getAnnotation(IndexId.class); if (tableId != null) { // 主键策略( 注解 > 全局 ) // 设置 Sequence 其他策略无效 @@ -523,7 +522,7 @@ public class EntityInfoHelper { */ public static boolean isExistTableId(List list) { for (Field field : list) { - TableId tableId = field.getAnnotation(TableId.class); + IndexId tableId = field.getAnnotation(IndexId.class); if (tableId != null) { return true; } @@ -552,7 +551,7 @@ public class EntityInfoHelper { private static void initTableName(Class clazz, GlobalConfig globalConfig, EntityInfo entityInfo) { // 数据库全局配置 GlobalConfig.DbConfig dbConfig = globalConfig.getDbConfig(); - TableName table = clazz.getAnnotation(TableName.class); + IndexName table = clazz.getAnnotation(IndexName.class); String tableName = clazz.getSimpleName().toLowerCase(Locale.ROOT); String tablePrefix = dbConfig.getTablePrefix(); diff --git a/easy-es-extension/pom.xml b/easy-es-extension/pom.xml index 00594392..134c0802 100644 --- a/easy-es-extension/pom.xml +++ b/easy-es-extension/pom.xml @@ -7,7 +7,7 @@ cn.easy-es easy-es-parent - 0.9.40 + 0.9.50 ../easy-es-parent diff --git a/easy-es-parent/pom.xml b/easy-es-parent/pom.xml index 8687194b..af2cf044 100644 --- a/easy-es-parent/pom.xml +++ b/easy-es-parent/pom.xml @@ -6,7 +6,7 @@ cn.easy-es easy-es-parent - 0.9.40 + 0.9.50 easy-es-parent easy use for elastic search diff --git a/easy-es-sample/pom.xml b/easy-es-sample/pom.xml index 8b8e6ffb..72f7299c 100644 --- a/easy-es-sample/pom.xml +++ b/easy-es-sample/pom.xml @@ -9,7 +9,7 @@ easy-es cn.easy-es - 0.9.40 + 0.9.50 diff --git a/easy-es-sample/src/main/java/cn/easyes/sample/entity/Document.java b/easy-es-sample/src/main/java/cn/easyes/sample/entity/Document.java index f2a22520..9b005fdf 100644 --- a/easy-es-sample/src/main/java/cn/easyes/sample/entity/Document.java +++ b/easy-es-sample/src/main/java/cn/easyes/sample/entity/Document.java @@ -1,9 +1,9 @@ package cn.easyes.sample.entity; import cn.easyes.annotation.HighLight; -import cn.easyes.annotation.TableField; -import cn.easyes.annotation.TableId; -import cn.easyes.annotation.TableName; +import cn.easyes.annotation.IndexField; +import cn.easyes.annotation.IndexId; +import cn.easyes.annotation.IndexName; import cn.easyes.common.constants.Analyzer; import cn.easyes.common.enums.FieldStrategy; import cn.easyes.common.enums.FieldType; @@ -18,12 +18,12 @@ import lombok.experimental.Accessors; **/ @Data @Accessors(chain = true) -@TableName(shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true) +@IndexName(shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true) public class Document { /** * es中的唯一id,如果你想自定义es中的id为你提供的id,比如MySQL中的id,请将注解中的type指定为customize或直接在全局配置文件中指定,如此id便支持任意数据类型) */ - @TableId(type = IdType.CUSTOMIZE) + @IndexId(type = IdType.CUSTOMIZE) private String id; /** * 文档标题,不指定类型默认被创建为keyword类型,可进行精确查询 @@ -33,37 +33,37 @@ public class Document { * 文档内容,指定了类型及存储/查询分词器 */ @HighLight(mappingField = "highlightContent") - @TableField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD) + @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD) private String content; /** * 作者 加@TableField注解,并指明strategy = FieldStrategy.NOT_EMPTY 表示更新的时候的策略为 创建者不为空字符串时才更新 */ - @TableField(strategy = FieldStrategy.NOT_EMPTY) + @IndexField(strategy = FieldStrategy.NOT_EMPTY) private String creator; /** * 创建时间 */ - @TableField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis") + @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis") private String gmtCreate; /** * es中实际不存在的字段,但模型中加了,为了不和es映射,可以在此类型字段上加上 注解@TableField,并指明exist=false */ - @TableField(exist = false) + @IndexField(exist = false) private String notExistsField; /** * 地理位置经纬度坐标 例如: "40.13933715136454,116.63441990026217" */ - @TableField(fieldType = FieldType.GEO_POINT) + @IndexField(fieldType = FieldType.GEO_POINT) private String location; /** * 图形(例如圆心,矩形) */ - @TableField(fieldType = FieldType.GEO_SHAPE) + @IndexField(fieldType = FieldType.GEO_SHAPE) private String geoLocation; /** * 自定义字段名称 */ - @TableField(value = "wu-la", fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) + @IndexField(value = "wu-la", fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) private String customField; /** diff --git a/easy-es-test/pom.xml b/easy-es-test/pom.xml index 29ce3ad6..e29ec2f0 100644 --- a/easy-es-test/pom.xml +++ b/easy-es-test/pom.xml @@ -7,7 +7,7 @@ easy-es cn.easy-es - 0.9.40 + 0.9.50 easy-es-test diff --git a/easy-es-test/src/main/java/cn/easyes/test/entity/Comment.java b/easy-es-test/src/main/java/cn/easyes/test/entity/Comment.java index 2f4bfe75..3a2854dd 100644 --- a/easy-es-test/src/main/java/cn/easyes/test/entity/Comment.java +++ b/easy-es-test/src/main/java/cn/easyes/test/entity/Comment.java @@ -1,7 +1,7 @@ package cn.easyes.test.entity; -import cn.easyes.annotation.TableField; -import cn.easyes.annotation.TableName; +import cn.easyes.annotation.IndexField; +import cn.easyes.annotation.IndexName; import cn.easyes.common.constants.Analyzer; import cn.easyes.common.enums.FieldType; import cn.easyes.common.params.JoinField; @@ -13,7 +13,7 @@ import lombok.Data; * Copyright © 2021 xpc1024 All Rights Reserved **/ @Data -@TableName(child = true) +@IndexName(child = true) public class Comment { /** * 评论id @@ -22,11 +22,11 @@ public class Comment { /** * 评论内容 */ - @TableField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) + @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) private String commentContent; /** * 父子关系字段 */ - @TableField(fieldType = FieldType.JOIN) + @IndexField(fieldType = FieldType.JOIN) private JoinField joinField; } diff --git a/easy-es-test/src/main/java/cn/easyes/test/entity/Document.java b/easy-es-test/src/main/java/cn/easyes/test/entity/Document.java index 40c5dc1d..bc98934d 100644 --- a/easy-es-test/src/main/java/cn/easyes/test/entity/Document.java +++ b/easy-es-test/src/main/java/cn/easyes/test/entity/Document.java @@ -1,9 +1,9 @@ package cn.easyes.test.entity; import cn.easyes.annotation.HighLight; -import cn.easyes.annotation.TableField; -import cn.easyes.annotation.TableId; -import cn.easyes.annotation.TableName; +import cn.easyes.annotation.IndexField; +import cn.easyes.annotation.IndexId; +import cn.easyes.annotation.IndexName; import cn.easyes.common.constants.Analyzer; import cn.easyes.common.enums.FieldStrategy; import cn.easyes.common.enums.FieldType; @@ -21,12 +21,12 @@ import java.util.List; **/ @Data @Accessors(chain = true) -@TableName(shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true, childClass = Comment.class) +@IndexName(shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true, childClass = Comment.class) public class Document { /** * es中的唯一id,如果你想自定义es中的id为你提供的id,比如MySQL中的id,请将注解中的type指定为customize或直接在全局配置文件中指定,如此id便支持任意数据类型) */ - @TableId(type = IdType.CUSTOMIZE) + @IndexId(type = IdType.CUSTOMIZE) private String id; /** * 文档标题,不指定类型默认被创建为keyword类型,可进行精确查询 @@ -36,37 +36,37 @@ public class Document { * 文档内容,指定了类型及存储/查询分词器 */ @HighLight(mappingField = "highlightContent",fragmentSize = 2) - @TableField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) + @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) private String content; /** * 作者 加@TableField注解,并指明strategy = FieldStrategy.NOT_EMPTY 表示更新的时候的策略为 创建者不为空字符串时才更新 */ - @TableField(strategy = FieldStrategy.NOT_EMPTY, fieldType = FieldType.KEYWORD_TEXT) + @IndexField(strategy = FieldStrategy.NOT_EMPTY, fieldType = FieldType.KEYWORD_TEXT) private String creator; /** * 创建时间 */ - @TableField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis") + @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis") private String gmtCreate; /** * es中实际不存在的字段,但模型中加了,为了不和es映射,可以在此类型字段上加上 注解@TableField,并指明exist=false */ - @TableField(exist = false) + @IndexField(exist = false) private String notExistsField; /** * 地理位置经纬度坐标 例如: "40.13933715136454,116.63441990026217" */ - @TableField(fieldType = FieldType.GEO_POINT) + @IndexField(fieldType = FieldType.GEO_POINT) private String location; /** * 图形(例如圆心,矩形) */ - @TableField(fieldType = FieldType.GEO_SHAPE) + @IndexField(fieldType = FieldType.GEO_SHAPE) private String geoLocation; /** * 自定义字段名称 */ - @TableField(value = "wu-la", fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) + @IndexField(value = "wu-la", fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART) private String customField; /** @@ -80,12 +80,12 @@ public class Document { /** * 嵌套类型 注意,务必像下面示例一样指定类型为nested及其nested class,否则会导致框架无法正常运行 */ - @TableField(fieldType = FieldType.NESTED, nestedClass = User.class) + @IndexField(fieldType = FieldType.NESTED, nestedClass = User.class) private List users; /** * 父子类型 须通过注解在父文档及子文档的实体类中指明其类型为Join,及其父名称和子名称 */ - @TableField(fieldType = FieldType.JOIN, parentName = "document", childName = "comment") + @IndexField(fieldType = FieldType.JOIN, parentName = "document", childName = "comment") private JoinField joinField; } diff --git a/easy-es-test/src/main/java/cn/easyes/test/entity/Faq.java b/easy-es-test/src/main/java/cn/easyes/test/entity/Faq.java index bf714b3b..ab8c109b 100644 --- a/easy-es-test/src/main/java/cn/easyes/test/entity/Faq.java +++ b/easy-es-test/src/main/java/cn/easyes/test/entity/Faq.java @@ -1,7 +1,7 @@ package cn.easyes.test.entity; -import cn.easyes.annotation.TableField; -import cn.easyes.annotation.TableName; +import cn.easyes.annotation.IndexField; +import cn.easyes.annotation.IndexName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -25,9 +25,9 @@ import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor -@TableName("faq") +@IndexName("faq") public class Faq { - @TableField("faq_name") + @IndexField("faq_name") private String faqName; private String faqAnswer; } diff --git a/easy-es-test/src/main/java/cn/easyes/test/entity/User.java b/easy-es-test/src/main/java/cn/easyes/test/entity/User.java index 9db9061f..e46a9315 100644 --- a/easy-es-test/src/main/java/cn/easyes/test/entity/User.java +++ b/easy-es-test/src/main/java/cn/easyes/test/entity/User.java @@ -1,6 +1,6 @@ package cn.easyes.test.entity; -import cn.easyes.annotation.TableField; +import cn.easyes.annotation.IndexField; import cn.easyes.common.constants.Analyzer; import cn.easyes.common.enums.FieldType; import lombok.AllArgsConstructor; @@ -18,13 +18,13 @@ import java.util.Set; @NoArgsConstructor @AllArgsConstructor public class User { - @TableField(value = "user_name", analyzer = Analyzer.IK_SMART) + @IndexField(value = "user_name", analyzer = Analyzer.IK_SMART) private String username; - @TableField(exist = false) + @IndexField(exist = false) private Integer age; /** * 多级嵌套 */ - @TableField(fieldType = FieldType.NESTED, nestedClass = Faq.class) + @IndexField(fieldType = FieldType.NESTED, nestedClass = Faq.class) private Set faqs; } diff --git a/pom.xml b/pom.xml index 8d49da6a..1556504b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.easy-es easy-es - 0.9.40 + 0.9.50 easy-es easy use for elastic search