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
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
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 mohitanchlia@gmail.comwrote:
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
Thanks, that helps. Can that "setType" be anything? I am assuming it's
another level of hierarchy.
On Wed, May 16, 2012 at 11:17 AM, Shairon Toledo
shairon.toledo@gmail.comwrote:
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 mohitanchlia@gmail.comwrote:
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
Yeap it is, you can understand that as, an index has many types.
On Wed, May 16, 2012 at 3:20 PM, Mohit Anchlia mohitanchlia@gmail.comwrote:
Thanks, that helps. Can that "setType" be anything? I am assuming it's
another level of hierarchy.On Wed, May 16, 2012 at 11:17 AM, Shairon Toledo <shairon.toledo@gmail.com
wrote:
You can index the json as string just setting the source, looks like
thisClient 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 mohitanchlia@gmail.comwrote:
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
--
Shairon Toledo
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.