Reputation: 101
I'm migrating to Elasticsearch 5 from 2 and we have integration tests which run on build servers which do not have ES nodes available. We have used the NodeBuilder from the previous version of ES to create in memory nodes on demand, but I can't find how to do the same thing with version 5.
Upvotes: 6
Views: 3711
Reputation: 61
First time posting in stack overflow, sorry if any mistake in how ask my question.
I had exactly the same problem where I start a client in memory, but I could not connect using the transport client having NoNodeAvailableException as error message.
Settings settings = Settings.builder()
.put("path.home", "target/elasticsearch")
.put("transport.type", "local")
.put("http.enabled", false)
.build();
node = new Node(settings).start();
Now in my test I inject node().client() to the repository and it worked.
For whole code, spring boot and ES 5 without spring-data which does not support ES 5: https://github.com/jomilanez/elastic5
Upvotes: 5
Reputation: 101
NodeBuilder
is removed from the API in ES 5 and the same thing can be achieved adding "transport.type" "local" to the settings and creating a node with
new Node(settings).start().client()
Upvotes: 2