本文仅用来记录平常学习所得,也希望能帮助到所有需要的人
实体类如下(Score类仅用来测试当序列不存在时生成新序列使用,Student是主要使用的测试类):
@Document(indexName = "test2",type = "score")
public class Score implements Serializable {
@Id
@Field(index = FieldIndex.not_analyzed,type = FieldType.Integer,store = true)
private Integer id;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String chinese;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String math;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String english;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getChinese() {
return chinese;
}
public void setChinese(String chinese) {
this.chinese = chinese;
}
public String getMath() {
return math;
}
public void setMath(String math) {
this.math = math;
}
public String getEnglish() {
return english;
}
public void setEnglish(String english) {
this.english = english;
}
}
@Document(indexName = "test1",type = "student")
public class Student implements Serializable {
/*@Id
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String id;*/
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String birthday;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String studentNo;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String sex;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String classNo;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String address;
@Field(index = FieldIndex.not_analyzed,type = FieldType.String,store = true)
private String name;
@Field(index = FieldIndex.not_analyzed,type = Field