You can index the json as string just setting the source, looks like this
Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
String source = yourJson.toString();
IndexResponse idxResp = client.prepareIndex().setIndex("documents").setType("document").setId("1")
.setSource(source).setRefresh(true).execute().actionGet();
On Tue, May 15, 2012 at 8:20 PM, Mohit Anchlia
<[hidden email]> wrote:
I am unable to find example of how to index Json String using Java API. Could someone help me with that?
I am converting xml to json. I see how to do it in REST api but not sure how this can be done in Java API
--
Shairon Toledo
http://hashcode.me