I'm trying to use shield plugin with elasticsearch while creating a es client in spring. I have added the following dependency to my pom.xml
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>shield</artifactId>
<version>2.4.0</version>
</dependency>
I'm creating the bean in the below fashion:
@Override
protected TransportClient createInstance() throws Exception
{
TransportClient client = null;
String userpass = this.username+":"+this.password;
client = TransportClient.builder()
.addPlugin(ShieldPlugin.class)
.settings(Settings.builder()
.put("shield.user", userpass)
.build()).build()
.addTransportAddress(toAddress());
return client;
}
But when the bean is created it gets the following error.
java.lang.ClassNotFoundException: org.elasticsearch.shield.ShieldPlugin
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
... 116 more
Any help on this is appreciated.
Thanks in advance.
I asked the Elastic.co support to fix this point. It was not the good dependency on the maven repository. Now the maven repository should work fine.
BR
Nicolas