Elasticsearch POJO mapping example
Elasticsearch POJO mapping example
@Document(indexName = "person")
public class Person implements Persistable<Long> {
@Id private Long id;
private String lastName;
private String firstName;
@Field(type = Date)
private Instant createdDate;
private String createdBy
@Field(type = Date)
private Instant lastModifiedDate;
private String lastModifiedBy;
@Override
public boolean isNew() {
return id == null || (createdDate == null && createdBy == null);
}
}
@Document(indexName = "person")
public class Person implements Persistable<Long> {
@Id private Long id;
private String lastName;
private String firstName;
@Field(type = Date)
private Instant createdDate;
private String createdBy
@Field(type = Date)
private Instant lastModifiedDate;
private String lastModifiedBy;
@Override
public boolean isNew() {
return id == null || (createdDate == null && createdBy == null);
}
}
Comments
Post a Comment