我正在使用 spring boot 2.0.2 和休眠搜索版本 5.10.2。我有以下类作为我的实体:
@Entity
@Table(name = "CUSTOMERS")
@Indexed(index = "indexes_customer")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Beneficiary implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Basic
@Column(name = "CARD_NUMBER", length = 18)
@Field(analyze = Analyze.NO, store = Store.YES)
@SortableField
private String cardNumber;
@Basic
@Column(name = "FULL_NAME", length = 60)
@Field(analyze = Analyze.NO, store = Store.YES)
@SortableField
private String fullName;
//Getters & setters
卡片数据以纯文本形式保存,但在向前台用户显示时被屏蔽。但是,我想在索引时屏蔽卡号。目前,我的索引如下所示:
{
"_index": "indexes_customer",
"_type": "mypackage.Customer",
"_id": "24",
"_version": 3,
"_score": 1,
"_source": {
"id": "24",
"name": "Customer Name",
"cardNumber": "1234567891011"
}
}
我希望它看起来更像这样:
{
"_index": "indexes_customer",
"_type": "mypackage.Customer",
"_id": "24",
"_version": 3,
"_score": 1,
"_source": {
"id": "24",
"name": "Customer Name",
"cardNumber": "1234******1011"
}
}
谢谢
相关分类