Elasticseach类型特殊@JsonIgnore

时间:2016-03-04 08:54:43

标签: java elasticsearch spring-boot entity spring-data-jpa

我有1个索引,2种类型。 /spring-boot-1.3.3 /

@Document(indexName = "main", type = "item")
@Entity
public class Item {
     private Long id;
     private String name;

     @ManyToOne
     private User owner;    
}

如何忽略userData字段仅用于类型:“item”

@Document(indexName = "main", type = "user")
@Entity
public class User {
    private Long id;
    private String userName;
    //@JsonIgnore <- ignored for both types, if i add this annotation
    private UserData userData; // must be ignored for elastic type: "item"
}

0 个答案:

没有答案