"Node Detection Disabled" in Elasticity Search Mode

I used the below Java code in UBUNTU and I get "Node Discovery Disabled". Because of this, I cannot move forward.

Can anyone help me solve this problem.

    public static JestClient JestConfiguration(){

    // Configuration
    ClientConfig client = new ClientConfig.Builder("http://localhost:9200")
                              .multiThreaded(true).build();

    System.out.println("\nclient configured via:- "+client);

    // Construct a new Jest client according to configuration via factory

    JestClientFactory factory = new JestClientFactory();
    factory.setClientConfig(client);
    System.out.println("\nJestClientFactory Via:-"+factory);

    JestClient jestClient = factory.getObject();
    System.out.println("\njestClient via:-"+jestClient);

    //jestClient.shutdownClient();
    return jestClient;
    }
+1
source share
1 answer

I am not sure which version you are using. I use 0.1.2, and factory I only have the setHttpClientConfig method. So I used HttpClientConfig , which extends ClientConfig . Note that the builder has two methods that you will need:

  • discoveryEnabled
  • discoveryFrequency

These are node node discovery settings and how often to poll.

HttpClientConfig httpClientConfig = new HttpClientConfig.Builder("http://localhost:9200") 
        .discoveryEnabled(true)
        .discoveryFrequency(10l, TimeUnit.SECONDS)
        .multiThreaded(true)
        .build();

JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(httpClientConfig);
+4
source

Source: https://habr.com/ru/post/1547623/


All Articles