2

I'm new to working with Elasticsearch mappings, I've created my class Bordereau with annotation inside the class and a json file which contains the mapping.

@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;

with the following mapping file : bordereau-mapping.json

{

  "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"
      }
    }
  }

}

That project is (still) working fine. but after a day, it throw the flowing exceptions

[ERROR] 2018-08-24 08:31:24.859 [http-nio-8080-exec-4] AcquisitionLogs:56 - ******* Exception : org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property 'dateCreation' found on class ma.accolade.ged.ms.gestion.acquisition.persistance.oe.BordereauOe! Did you mean: dateCreation?
[ERROR] 2018-08-24 09:35:04.429 [http-nio-8080-exec-9] AcquisitionLogs:56 - ******* Exception : org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property 'idUser' found on class ma.accolade.ged.ms.gestion.acquisition.persistance.oe.PreferenceAffichageOe! Did you mean: idUser?
[ERROR] 2018-08-24 09:36:04.537 [http-nio-8080-exec-6] AcquisitionLogs:56 - ******* Exception : org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property 'id' found on class ma.accolade.ged.ms.gestion.acquisition.persistance.oe.DocumentOe! Did you mean: id?

Thanks again in advance for your help.

1 Answer 1

1

You have wrong type definitions in class vs mapping. for eg:

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"
  }

please go through all the field definitions between class and mapping and make sure it matches

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for ur ansswer and if I have a field in my class with type List<String> how can I mapped it
here is the documentation for array type elastic.co/guide/en/elasticsearch/reference/1.4/… please select the version that you're using

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.