How to get Coordinating node client

Hi
Migrating to es 5.4.1 from es 2.3.2. Previously We were using nodeclient in our application. How to achieve the same in es 5.4.1 ? I have tried the coordinating node but the node not getting joined to the cluster.

es 2.3.2 snippet

 Settings.Builder builder = Settings.settingsBuilder();
   builder.put("node.client", true);
   builder.put("node.data", false);
    builder.put("cluster.name", clusterName);
    builder.put("discovery.zen.ping.multicast.enabled", "false");
    builder.put("discovery.zen.ping.unicast.hosts", "ip1,ip2");
    builder.put("http.enabled", false);
    builder.put("path.home", "/");
    builder.put("network.host", getHostIpAddress());
    builder.build();
    Node node = NodeBuilder.nodeBuilder().client(true).settings(builder).node();
    Client nodeClient =  node.client();

IndexRequestBuilder indexRequest = nodeClient.prepareIndex(indexName, type);

es 5.4.1 snippet

   Settings.Builder builder = Settings.builder();
         builder.put("node.data", false);
  builder.put("node.master", false);
  builder.put("node.ingest", false);
  builder.put("search.remote.connect", false);
         builder.put("cluster.name", clusterName);
  builder.put("discovery.zen.ping.unicast.hosts", "ip1,ip2");
  builder.put("http.enabled", false);
  builder.put("path.home", "../");
  builder.put("network.host", getHostIpAddress());
  builder.put("transport.type", "local");
  Settings nodeSettings = builder.build();
  Node node = new Node(nodeSettings);
  Client nodeClient =  node.client();

IndexRequestBuilder indexRequest = nodeClient.prepareIndex(indexName, type);

Node clients are no longer supported in Elasticsearch. You should use the transport client instead, or preferrably the Java REST client if you can.

Thanks for your reply. We are indexing nearly 20 billion messages with the size of 13TB per day. So far nodeclients are good load balancers for us which mainly avoids the transport client's two hop operation. Curious to know the reason why it is removed ?

This blog post details the reasons why the node/client/embedded nodes are not supported: https://www.elastic.co/blog/elasticsearch-the-server

Thanks for the info. Is it possible (or any plans to implement) to say the datanode in restclient while indexing ? So that caching the index routing table periodically in applicaiton and route to the right data node will help to reduce unnecessary the data flow over network.Or a hook to override sniffers round robin implementation ?

There is currently no way to do this in the transport or REST clients.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.