java - Save entity containing gson atribute to ElasticSearch in Spring -


my spring application uses spring-data-elasticsearch (https://github.com/spring-projects/spring-data-elasticsearch).

i save following document elasticsearch database:

    @document(indexname = "documents", type = "customentity", replicas = 0, shards = 5)     public class customentity implements serializable{          @id         private string id;           @field(type = fieldtype.string)         private string field1;         @field(type = fieldtype.integer)         private int field2;         @field(type = fieldtype.object)  //not sure annotation should use         private jsonobject exportjson;   //gson object          ...getters , setters...     } 

using way:

public class customentitydao {      @resource     elasticsearchtemplate elasticsearchtemplate;              public void insertcustomentity(customentity entity){                  indexquery indexquery = new indexquery();         indexquery.setid(entity.getcustomentityid());         indexquery.setobject(entity);          elasticsearchtemplate.index(indexquery);  //exception thrown      }     } 

but i'm getting error:

com.fasterxml.jackson.databind.jsonmappingexception: jsonobject (through reference chain: data.nosql.entities.customentity ["exportjson"]->com.google.gson.jsonobject["asstring"])

i understand problem don't have clue how solve it. ideas please?

my guess jackson tries covert gson object string indexable es , doesn't know how that. if post full stack trace it'll more helpful, if have take guess need use @jsonserializer annotation on "exportjson" object.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -