Hi, I have been trying to use TransportClient instead of HttpClient to connect to ElasticSearch. However I am not sure how basic credentials can be supplied to TransportClient to connect.
I know how this can be achieved with HttpClient. Could you please reply.
Thanks David,
I have tried the same. However I get the following exception when new PreBuiltXPackTransportClient is being called.
Exception in thread "main" java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings$Builder.put([Ljava/lang/Object;)Lorg/elasticsearch/common/settings/Settings$Builder;
at org.elasticsearch.xpack.notification.email.Account.(Account.java:67)
at org.elasticsearch.xpack.XPackPlugin.(XPackPlugin.java:191)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:601)
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:113)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:110)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:135)
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:288)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:128)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:55)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:50)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:46)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.