6

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.

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

org.elasticsearch.node,Node is an abstract class in elasticsearch 6.8.4
2

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()

1 Comment

org.elasticsearch.node,Node is an abstract class in elasticsearch 6.8.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.