hi
I downloaded the xpack transport jar file v 5.3 from https://www.elastic.co/guide/en/x-pack/current/java-clients.html
After that i tested with example-
import java.net.InetAddress;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.xpack.XPackClient;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
public class TestXpaac {
public static void main(String[] args){
Settings settings = Settings.builder().put("xpack.security.user", "elastic:password").build();
try{
TransportClient client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress(new
InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));
// ActionFuture<ClusterHealthResponse> healthFuture =
client.admin().cluster().health(Requests.clusterHealthRequest());
System.out.println("kl="+client.settings().getAsMap());
XPackClient xpackClient = new XPackClient(client);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
but even after including the jar in build path i get compiler exception while importing org.elasticsearch.xpack.XPackClient
I am able to do the same if i use a maven project.
In that it specifies the org.elasticsearch.plugin x-pack-api- 5.3.0 version.
This version is not present in the maven website.The latest is 5.0.0.
Is something wrong with the jar in the website?
Please help.
Thanks