IndexRequestBuilder prepareIndex = client.prepareIndex(indexName, indexType, indexId);
Object document = extractDocumentFromMessage(exchange.getIn());
if (!setIndexRequestSource(document, prepareIndex)) {
throw new ExpectedBodyTypeException(exchange, XContentBuilder.class);
}
ListenableActionFuture<IndexResponse> future = prepareIndex.execute();
IndexResponse response = future.actionGet();
exchange.getIn().setBody(response.getId());
}