@Document(indexName = "opportunity_data", type = "opportunities", createIndex = false)
@Setting(settingPath = "/search/settings.json")
@Data
@Accessors(chain = true)
@JsonIgnoreProperties(value = {"id"}, allowGetters = true, allowSetters = false)
public class OpportunityVo extends AbstractGenericVo<Opportunity> {
@Id
@Field(type = FieldType.Long)
private Long opportunityId;
@Field(type = FieldType.Long)
private Long prospectId;
@Field(type = FieldType.Text)
private String prospectName;
}
mapping to keyword snapshot
上面的
opportunityId
映射到keyword
类型以外的long
。因为我想对此属性进行long
指标聚合,所以谁知道在同时注释@Id
时如何将机会ID 映射到stats
类型?
最佳答案
统计汇总只能应用于数字。更改映射工作正常。但是@Id将映射到关键字,仍然没有运气。
关于elasticsearch - spring-data-elasticsearch-在同一字段上注释@Id时,@ Field映射类型将被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53481032/