mirror of
https://gitee.com/dromara/easy-es.git
synced 2025-12-06 17:18:57 +08:00
1.@IndexName注解新增设置max_result_window参数功能 2.调整注解依赖,将注解包独立,便于多模块项目用户使用 3.原PageInfo更名为EsPageInfo,解决与分页插件名称冲突问题 4.调整banner样式,看起来更正式好看 5.调整版本检测日志打印,jar依赖不满足直接打印error级别日志提示用户解决依赖冲突 6.修复1.0.3版本引入的一处avg聚合方法重载缺陷 @郑建建
78 lines
2.6 KiB
Java
78 lines
2.6 KiB
Java
package cn.easyes.sample.entity;
|
|
|
|
import cn.easyes.annotation.HighLight;
|
|
import cn.easyes.annotation.IndexField;
|
|
import cn.easyes.annotation.IndexId;
|
|
import cn.easyes.annotation.IndexName;
|
|
import cn.easyes.annotation.rely.Analyzer;
|
|
import cn.easyes.annotation.rely.FieldStrategy;
|
|
import cn.easyes.annotation.rely.FieldType;
|
|
import cn.easyes.annotation.rely.IdType;
|
|
import lombok.Data;
|
|
import lombok.experimental.Accessors;
|
|
|
|
/**
|
|
* es 数据模型
|
|
* <p>
|
|
* Copyright © 2021 xpc1024 All Rights Reserved
|
|
**/
|
|
@Data
|
|
@Accessors(chain = true)
|
|
@IndexName(value = "easyes_document", shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true,maxResultWindow = 100)
|
|
public class Document {
|
|
/**
|
|
* es中的唯一id,如果你想自定义es中的id为你提供的id,比如MySQL中的id,请将注解中的type指定为customize或直接在全局配置文件中指定,如此id便支持任意数据类型)
|
|
*/
|
|
@IndexId(type = IdType.CUSTOMIZE)
|
|
private String id;
|
|
/**
|
|
* 文档标题,不指定类型默认被创建为keyword类型,可进行精确查询
|
|
*/
|
|
private String title;
|
|
/**
|
|
* 文档内容,指定了类型及存储/查询分词器
|
|
*/
|
|
@HighLight(mappingField = "highlightContent")
|
|
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART)
|
|
private String content;
|
|
/**
|
|
* 作者 加@TableField注解,并指明strategy = FieldStrategy.NOT_EMPTY 表示更新的时候的策略为 创建者不为空字符串时才更新
|
|
*/
|
|
@IndexField(strategy = FieldStrategy.NOT_EMPTY)
|
|
private String creator;
|
|
/**
|
|
* 创建时间
|
|
*/
|
|
@IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
|
|
private String gmtCreate;
|
|
/**
|
|
* es中实际不存在的字段,但模型中加了,为了不和es映射,可以在此类型字段上加上 注解@TableField,并指明exist=false
|
|
*/
|
|
@IndexField(exist = false)
|
|
private String notExistsField;
|
|
/**
|
|
* 地理位置经纬度坐标 例如: "40.13933715136454,116.63441990026217"
|
|
*/
|
|
@IndexField(fieldType = FieldType.GEO_POINT)
|
|
private String location;
|
|
/**
|
|
* 图形(例如圆心,矩形)
|
|
*/
|
|
@IndexField(fieldType = FieldType.GEO_SHAPE)
|
|
private String geoLocation;
|
|
/**
|
|
* 自定义字段名称
|
|
*/
|
|
@IndexField(value = "wu-la", fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART,fieldData = true)
|
|
private String customField;
|
|
|
|
/**
|
|
* 高亮返回值被映射的字段
|
|
*/
|
|
private String highlightContent;
|
|
/**
|
|
* 文档点赞数
|
|
*/
|
|
private Integer starNum;
|
|
}
|