Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7665F200C84 for ; Mon, 15 May 2017 07:43:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 75131160BCC; Mon, 15 May 2017 05:43:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B1CEB160BB7 for ; Mon, 15 May 2017 07:43:43 +0200 (CEST) Received: (qmail 46479 invoked by uid 500); 15 May 2017 05:43:42 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Delivered-To: moderator for users@camel.apache.org Received: (qmail 83032 invoked by uid 99); 14 May 2017 12:45:04 -0000 X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.486 X-Spam-Level: *** X-Spam-Status: No, score=3.486 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Date: Sun, 14 May 2017 05:44:59 -0700 (MST) From: nesrine To: users@camel.apache.org Message-ID: <1494765899246-5799479.post@n5.nabble.com> Subject: Store data in elasticsearch using apache camel MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Mon, 15 May 2017 05:43:44 -0000 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.