Hi I have a complex json string like
[{"id":1,"name":"test1"},{"id":2,"name":"test2"},...]
I convert this body into map but I can't index into elasticsearch due to
this error 

Caused by: org.apache.camel.TypeConversionException: Error during type
conversion from type: java.lang.String to the required type:
org.elasticsearch.action.index.IndexRequest with value [{id=1, nom=test1},
{id=2, nom=test2... [Body clipped after 1000 chars, total length is 26866]
due java.lang.NullPointerException

How can I resolve this problem ? 
Ps how I convert the body into map : 
String body =exchange.getIn().getBody(String.class);
        
                
                
            try {
                TypeFactory typeFactory = mapper.getTypeFactory();
                CollectionType collectionType =
typeFactory.constructCollectionType(
                                                    List.class, Object.class);
                        exchange.getIn().setBody(mapper.readValue(body, 
collectionType));

            } catch (IOException e) {
                e.printStackTrace();
            }




--
View this message in context: 
http://camel.465427.n5.nabble.com/Store-data-in-elasticsearch-using-apache-camel-tp5799479.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to