Then when I try to use client.prepareIndex as follows:
String documentId="1";
IndexResponse response = client.prepareIndex("libraryf","books",documentId)....
The Eclipse IDE shows the following error message:
the method prepareIndex(String, String, String) is undefined for the type Client.
I am using Elastic Search 2.3.5.
Any ideas on why I am getting this message when using client.prepareIndex?
I had the correct jar file, but when I used CTRL-SHIFT-O I selected the wrong import package for client. Once I select the correct one, the issue was resolved. Thanks.
And get the error below. : It thinks 127.0.0.1:9300 is not part of the cluster.
16:34:44.735 [main] WARN org.elasticsearch.client.transport - [Grappler] node {#transport#-1}{127.0.0.1}{localhost/127.0.0.1:9300} not part of the cluster Cluster [elasticsearch], ignoring...
Starting Query 1470861285037
Query Completed and ran for 622 ms
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{localhost/127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
clusterName is set to
final String clusterName = "elasticsearch_dev";
which is the same cluster name in my elasticsearch.yml file cluster.name: elasticsearch_dev
That would explain why it works only when I change the custer.name to elasticsearch in the yml file.
Doesn't the client need both the cluster name and the transport address? If so how does one set this up in one statement. Can you provide me with an example or a link to an example on how to do this in one step?
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.