环境
jdk17
SpringBoot 3.1.0
Elasticsearch 8.7.0
Java的Doc对象中如何正确映射我的经度纬度,进行创建Index和Mapping,以便于后期做坐标geo查询?
@Data
@Accessors(chain = true)
@Schema(name = "帖子文档",description = "")
@Document(indexName = "post_index")
public class PostDoc {
/** 文章id */
@Id
@Schema(description = "文章id")
private Long postId ;
/** 用户id */
@Field(type = FieldType.Integer)
@Schema(description = "用户id")
private Long userId ;
/** 墙类型 */
@Schema(description = "墙类型")
@Field(type = FieldType.Integer)
private Integer wallTypeId ;
/** 内容;针对一些特殊的墙类型存放特定数据用的。例如 @ta的信息 */
@Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
@Schema(description = "内容")
private String content ;
/** 声音 */
@Field(type = FieldType.Text,index = false)
@Schema(description = "声音")
private String soundUrl ;
/** 图片url */
@Field(type = FieldType.Text,index = false)
@Schema(description = "图片url")
private String imagesUrl ;
/** 其他信息 */
@Schema(description = "其他信息")
@Field(type = FieldType.Text,index = false)
private String other ;
/** 学校id */
@Field(type = FieldType.Integer)
@Schema(description = "学校id")
private Long schoolId ;
/** 省份 */
@Field(type = FieldType.Text)
@Schema(description = "省份")
private String province ;
/** 市 */
@Field(type = FieldType.Text)
@Schema(description = "市")
private String municipal ;
/** 详细地址 */
@Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
@Schema(description = "详细地址")
private String detailedAddress ;
/** 经度 */
@Schema(description = "经度")
private Double longitude ;
/** 纬度 */
@Schema(description = "纬度")
private Double latitude ;
/** 是否公开地址 */
@Field(type = FieldType.Boolean)
@Schema(description = "是否公开地址")
private Boolean isPublicAddress ;
/** 是否匿名 */
@Field(type = FieldType.Boolean)
@Schema(description = "是否匿名")
private Boolean isAnonymous ;
/** 文章状态;0 待审核 1 通过 2 违规 */
@Field(type = FieldType.Integer)
@Schema(description = "文章状态")
private Integer state ;
}