Reputation: 86
In elasticsearch, when I try to create a index and type I got this exception. "None of the configured nodes are available: []" The following are the code which I use to create "preparIndex".
public class Test {
static {
CLIENT = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 13101));
}
public static void main(String arg[]) {
try {
IndexResponse response = CLIENT
.prepareIndex("twitter", "tweet", "1")
.setSource(jsonBuilder()
.startObject()
.field("user", "kimchy")
.field("postDate", new Date())
.field("message", "trying out Elasticsearch")
.endObject())
.execute()
.actionGet();
} catch(Exception e) {
System.out.println(e.getMessage());
}
}
}
Can any one help me. Thank you.
Upvotes: 1
Views: 4689
Reputation: 26
I had the same issue and finally found the reason, that is I used the default port 9200 (the correct is 9300 as default).
Upvotes: 1