Elastic search java client. Initialisation of TransportClient takes long time

827 views Asked by At

Why does default initialisation of TransportClient() for elasticsearch takes much more time then initialisation of jest client?

Code for TransportClient:

private static Client client = new TransportClient()
        .addTransportAddress(
                new InetSocketTransportAddress("localhost", 9200)
        );

Code for jest client:

JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig.Builder("http://localhost:9200")
                                .multiThreaded(true)
                                .build());
client = factory.getObject();

Jest client is light. However I need some extended functionality that have elasticsearch java client, but doesn't have jest client.

Is it possible to decrease time of initialisation for TransportClient by configuration? Why does it take too much time?

P.S. Initialisation of TransportClient takes approximately 6+ sec for me on Mac 16 GB of RAM.

Please, not that I initialise clients just once in code (using static and/or thread safe singleton)

0

There are 0 answers