springboot整合ElasticSearch 某个属性不存储到ES
在需要忽略的字段上加上 @Transient (org.springframework.data.annotation.Transient)即可
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
@Document(indexName = "shop", type = "sku")
public class SkuIndex {
@Id
private Integer skuId;
/**
* 图片列表
*/
@Transient
private List<SkuImgIndex> skuImgList;
}