首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Spring data elasticsearch映射

Spring data elasticsearch映射
EN

Stack Overflow用户
提问于 2018-08-28 00:17:37
回答 1查看 1.2K关注 0票数 2

我刚开始使用Elasticsearch映射,我已经创建了我的类Bordereau,并在类中添加了注释,并创建了一个包含映射的json文件。

代码语言:javascript
复制
@Document(indexName = "#{@profilePrefixe}_bordereau", type = "Bordereau")
@Mapping(mappingPath = "/mapping/bordereau-mapping.json")
public class BordereauOe {
    @Id
    private String idBordereau;
    @Field(type= FieldType.Keyword)
    private String numBordereau;
    private String idCreateur;
    private int existe;
    private String dateCreation;
    private Long dateCreationMiliseconde;
    private int nbrDossier;
    private int nbrDossierTraiter;
    private boolean statut;
    private boolean statutSaturatoin;
    private String bordereauFile;
    @Field(type= FieldType.Keyword)
    private String nomClient;
    private int nbrDossierAffecter;
    private String cabinet;
    @Field(type= FieldType.Keyword)
    private String compagnie;
    private int nbrDossierAjoutes;

使用以下映射文件: bordereau-mapping.json

代码语言:javascript
复制
{

  "Bordereau" : {
    "properties" : {
      "accusedFiles" : {
        "type" : "text"
      },
      "bordereauFile" : {
        "type" : "text"
      },
      "cabinet" : {
        "type" : "keyword"
      },
      "compagnie" : {
        "type" : "keyword"
      },
      "dateCreation" : {
        "type" : "date",
        "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd"
      },
      "dateCreationMiliseconde" : {
        "type" : "long"
      },
      "existe" : {
        "type" : "long"
      },
      "idBordereau" : {
        "type" : "text"
      },
      "idCreateur" : {
        "type" : "text"
      },
      "nbrDossier" : {
        "type" : "long"
      },
      "nbrDossierAffecter" : {
        "type" : "long"
      },
      "nbrDossierAjoutes" : {
        "type" : "long"
      },
      "nbrDossierTraiter" : {
        "type" : "long"
      },
      "nomClient" : {
        "type" : "keyword"
      },
      "numBordereau" : {
        "type" : "keyword"
      },
      "statut" : {
        "type" : "boolean"
      },
      "statutSaturatoin" : {
        "type" : "boolean"
      }
    }
  }

}

那个项目(仍然)运行得很好。但是一天后,它抛出流异常

你的意思是: dateCreation?

你的意思是: idUser?

ERROR 2018-08-24 09:36:04.537 http-nio-8080-exec-6 AcquisitionLogs:56 -*异常:在类ma.accolade.ged.ms.gestion.acquisition.persistance.oe.DocumentOe!上找不到属性'id‘你的意思是: id?

再次感谢您的帮助。

EN

回答 1

Stack Overflow用户

发布于 2018-08-28 00:45:32

您在类与映射中有错误的类型定义。例如:

代码语言:javascript
复制
public class BordereauOe {
   private String dateCreation;
}

and in mapping, you have it defined as Date

"dateCreation" : {
    "type" : "date",
    "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd"
  }

请检查类和映射之间的所有字段定义,并确保它们匹配

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52043318

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档