spring-data-elasticsearch-在同一字段上注释@Id时,@ Field映射类型将被忽略

时间:2018-11-26 12:21:33

标签: elasticsearch spring-data mapping

@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时将 opportunityId 映射到stats类型吗?

1 个答案:

答案 0 :(得分:0)

统计信息汇总只能应用于数字。更改映射工作正常。但是@Id将映射到关键字,仍然没有运气。