Spring Data ElasticSearch嵌套类型内部对象不匹配

时间:2014-07-03 03:43:30

标签: java spring elasticsearch spring-data

这是我创建的POJO。

public class PatientDocument {

    @Id
    private String id;

    @Field
    private String patientPin;

    @Field
    private String firstName;

    @Field
    private String LastName;

    @Field
    private String middleName;

    @Field(type = FieldType.Nested)
    private List<Consultation> consultations;

   //getters setters...

这是咨询

public class Consultation {

    private String id;

    private List<String> prescriptions;

    private List<String> diagnosis;

    private String documentDate;

    getters and setters

然而,当我检查映射时。咨询不是嵌套类型

{
  "tenant1" : {
    "mappings" : {
      "patient" : {
        "properties" : {
          "consultations" : {
            "properties" : {
              "diagnosis" : {
                "type" : "string"
              },
              "documentDate" : {
                "type" : "date",
                "format" : "dateOptionalTime"
              },
              "prescriptions" : {
                "type" : "string"
              }
            }
          },
          "firstName" : {
            "type" : "string"
          },
          "lastName" : {
            "type" : "string"
          },
          "middleName" : {
            "type" : "string"
          },
          "patientPin" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

0 个答案:

没有答案