Yes, which is why I was baffled. In fact, the code I used was straight out of that specific page. The client code also came straight from the docs. (http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/client.html):
So the code I used from the documentation that appears so basic does not work even though my cluster is running. The docs make it very simple, so I am surprised it does not work out of the box on my local machine with a single node (running on my local machine on OSX installed using brew for latest ES 1.5, the Java Elasticsearch jar is also 1.5: Node node = nodeBuilder().clusterName("yourclustername").node(); // I replaced yourclustername with my cluster name //Node node = nodeBuilder().clusterName("yourclustername").client(true).node(); // this does not work either Client client = node.client(); String json = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elasticsearch\"" + "}"; IndexResponse response = client.prepareIndex("twitter", "tweet") .setSource(json) .execute() .actionGet(); What is the problem? On Wednesday, March 25, 2015 at 12:34:49 AM UTC-4, Mark Walkom wrote: > > I don't mean to be rude, but just because it doesn't work doesn't make it > a joke. > > Have you read the docs? > http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html > > On 25 March 2015 at 14:44, Sai Asuka <asuka...@gmail.com <javascript:>> > wrote: > >> The problem is in either case, I see no new index or anything. >> >> On Tuesday, March 24, 2015 at 11:43:49 PM UTC-4, Sai Asuka wrote: >>> >>> I am using elasticsearch java client, indexing a document "looks" simple. >>> I know 100% my cluster is running, and my name is create. >>> >>> Node node = nodeBuilder().clusterName("mycluster").node(); >>> >>> Client client = node.client(); >>> >>> String json = "{" + >>> >>> "\"user\":\"kimchy\"," + >>> >>> "\"postDate\":\"2013-01-30\"," + >>> >>> "\"message\":\"trying out Elasticsearch\"" + >>> >>> "}"; >>> >>> >>> IndexResponse response = client.prepareIndex("twitter", "tweet") >>> >>> .setSource(json) >>> >>> .execute() >>> >>> .actionGet(); >>> >>> I read somewhere that you should shove ".client(true)", but I get: >>> >>> >>> org.elasticsearch.discovery.MasterNotDiscoveredException >>> >>> What gives? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "elasticsearch" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elasticsearc...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elasticsearch/4c62ee1f-6224-4749-bd28-16e47a200b09%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elasticsearch/4c62ee1f-6224-4749-bd28-16e47a200b09%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/252076e0-b1d9-4142-b108-72b47f7841dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.