Open FlatsWire-Niko opened 7 years ago
Hi Nicolas!
No problem with you contacting me.
Unfortunately, I could not find any solution. After spending many days on this, I decided it's just not worth it and did the same thing as you, which is switching back to 2.x.x. Not sure where you found this repo, but I created it as part of this topic in the ES forum - https://discuss.elastic.co/t/errors-when-using-spring-data-elasticsearch-version-3-0-0-build-snapshot-and-elasticsearch-5-4-0/90525. Maybe there's something there that can help you.
Good luck!
Hi Cristian,
Thanks a lot for your feedback. I’ve found your repo from the link you pasted in your email. If I find something later I’ll drop you an email!
Thanks again and good luck! Nicolas
Le 31 août 2017 à 17:42, Cristian Gavrila notifications@github.com a écrit :
Hi Nicolas!
No problem with you contacting me.
Unfortunately, I could not find any solution. After spending many days on this, I decided it's just not worth it and did the same thing as you, which is switching back to 2.0.4. Not sure where you found this repo, but I created it as part of this topic in the ES forum - https://discuss.elastic.co/t/errors-when-using-spring-data-elasticsearch-version-3-0-0-build-snapshot-and-elasticsearch-5-4-0/90525 https://discuss.elastic.co/t/errors-when-using-spring-data-elasticsearch-version-3-0-0-build-snapshot-and-elasticsearch-5-4-0/90525. Maybe there's something there that can help you.
Good luck!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CGavrila/spring-data-elasticsearch/issues/1#issuecomment-326336288, or mute the thread https://github.com/notifications/unsubscribe-auth/AGLvZIQgTwxvNaiRI-PE6GpyqwW1Z1exks5sdtR-gaJpZM4PI_E7.
I also have the same issue - No solution for the moment
Thanks @rfanjul for the comment. Just saw it, sorry!
I have recently tried again and I didn't get anywhere.
@rfanjul @FlatsWire-Niko I have also opened this issue in their official Jira board - https://jira.spring.io/browse/DATAES-364. There has been no reply, but if more people report/flag this in some way, maybe there's a chance.
Try excluding ElasticsearchDataAutoConfiguration. i.e. @SpringBootApplication(exclude=ElasticsearchDataAutoConfiguration.class). I did this, now my project is working.
Thanks for the suggestion @mansoor67890, will try and leave a comment here.
@mansoor67890 Again, thanks for the suggestion!
I tried that, but I need to replace the stuff in ElasticsearchDataAutoConfiguration.class
with other @Bean
s. Did you do that manually?
No, @CGavrila I did this only: @springbootapplication(exclude=ElasticsearchDataAutoConfiguration.class).
@mansoor67890 I tried that too, but then Spring immediately complained about elasticsearchTemplate
missing, so there must be something else in your case that creates the elasticsearchTemplate
@Bean
and anything else that is missing.
Ping @FlatsWire-Niko @rfanjul
I managed to get it working with Elasticsearch 5.5.3. I've tried with the new 6.0.0, but wasn't able to get it working.
My pom.xml
file looks a bit like:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M6</version> <======================= (latest version)
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<elasticsearch.version>5.5.0</elasticsearch.version> <=======================
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency> <======================= (no version in here)
.......
</dependencies>
I also run my ES via Docker compose:
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3
container_name: elasticsearch
environment:
- cluster.name=local
- discovery.type=single-node
- xpack.security.enabled=false
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
ports:
- 9200:9200
- 9300:9300
Hope this helps someone else.
Yes for elasticsearchTemplate. @Bean public ElasticsearchTemplate elasticsearchTemplate() { return new ElasticsearchTemplate(client()); }
I am doing this in my pom:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>${spring-data-elastic-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency>
and
<spring-data-elastic-version>3.0.1.RELEASE</spring-data-elastic-version>
<elasticsearch.version>5.5.0</elasticsearch.version>
Hi all, I will also try this solution I will post here soon ! Thanks!
Hi All,
Thanks @CGavrila for your posts. It was really useful ! I've been able to make things working. Here my stack: a docker image ES 5.6.5 with a spring data 3.0.2.RELEASE application (via spring boot 2.0.0.M7).
Docker command:
docker run --name es5 -e "xpack.security.enabled=false" -e "cluster.name=es5" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 docker.elastic.co/elasticsearch/elasticsearch:5.6.5
In my pom:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M7</version>
<relativePath></relativePath>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
...
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
</dependency>
...
My ES template:
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
Settings settings = Settings.builder().put("cluster.name", "es5").build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("0.0.0.0"), 9300));
return new ElasticsearchTemplate(client);
}
My contact at elastic told me it is not yet possible to use spring data with ES 6.0.
Thank you for sharing, Nicolas. Hopefully, this will help others too.
Hello ,
I was fighting a little bit with it for for me still I am stack with the last solution, the exception I got is:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.Client]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings.settingsBuilder()Lorg/elasticsearch/common/settings/Settings$Builder; at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ... 37 more
for other side I also need xpack.security=true, here example of my pom:
` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>example</groupId>
<artifactId>example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>example</name>
<description>example</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M1</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
<elasticsearch.version>5.6.0</elasticsearch.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>1.4.3.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-maven-plugin -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.M1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>runtime</scope>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.9.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>4.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
<scope>test</scope>
</dependency>
<!-- mail -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>1.5.6.RELEASE</version>
</dependency>
<!-- template system -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<!-- -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<!-- data -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.collections/google-collections -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>
<!-- ElasticSearch -->
<!-- <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.0.0</version>
</dependency> -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
</dependency>
<!--<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>5.6.0</version>
</dependency>-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.reflections/reflections -->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<!-- token -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.52</version>
</dependency>
<!-- documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>3.2.0.201312181205-r</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.220</version>
</dependency>
<!-- excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<testCompilerArgument>-parameters</testCompilerArgument>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>dealini.commands.GenerateModelsCommands</mainClass>
<arguments>
<argument>-parameters</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<copy tofile="${basedir}/target/Dockerfile"
file="${basedir}/../docker-elk/system/Dockerfile"/>
</tasks>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>statistics</imageName>
<dockerDirectory>${basedir}/target/</dockerDirectory>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>https://repo.spring.io/plugins-release/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>elasticsearch-releases</id>
<url>https://artifacts.elastic.co/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
`
@FlatsWire-Niko @CGavrila @mansoor67890 Hi, I am also trying to get this to work on localhost but have failed to do so. I am using 2.0.0.M7 for spring boot, 3.0.2-RELEASE for spring-data-elasticsearch, and 5.5.3 for elasticsearch.
Here is my dependency tree for elasticsearch
[INFO] +- org.springframework.data:spring-data-elasticsearch:jar:3.0.2.RELEASE:compile
[INFO] | +- org.elasticsearch:elasticsearch:jar:5.5.3:compile
[INFO] | | +- org.elasticsearch:securesm:jar:1.1:compile
[INFO] | | \- org.elasticsearch:jna:jar:4.4.0:compile
[INFO] | +- org.elasticsearch.client:transport:jar:5.5.3:compile
[INFO] | | +- org.elasticsearch.plugin:transport-netty3-client:jar:5.5.3:compile
[INFO] | | +- org.elasticsearch.plugin:reindex-client:jar:5.5.3:compile
[INFO] | | | \- org.elasticsearch.client:rest:jar:5.5.3:compile
[INFO] | | +- org.elasticsearch.plugin:lang-mustache-client:jar:5.5.3:compile
[INFO] | | +- org.elasticsearch.plugin:percolator-client:jar:5.5.3:compile
[INFO] | | \- org.elasticsearch.plugin:parent-join-client:jar:5.5.3:compile
[INFO] | \- org.elasticsearch.plugin:transport-netty4-client:jar:5.5.3:compile
and my ElasticsearchConfig looks like this
@Configuration
@EnableElasticsearchRepositories( basePackageClasses = com.xxx.search.repository.NoOp.class )
@Profile( "!test" )
public class ElasticsearchConfig
{
@Value( "${spring.data.elasticsearch.cluster-nodes}" )
private String clusterNodes;
@Value( "${spring.data.elasticsearch.cluster-name}" )
private String clusterName;
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
Settings settings = Settings.builder().put("cluster.name", clusterName).build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
return new ElasticsearchTemplate(client);
}
}
but when I hit run, I got errors like this:
...
aused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.client.transport.TransportClient.builder()Lorg/elasticsearch/client/transport/TransportClient$Builder;
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
... 68 common frames omitted
Caused by: java.lang.NoSuchMethodError: org.elasticsearch.client.transport.TransportClient.builder()Lorg/elasticsearch/client/transport/TransportClient$Builder;
at org.springframework.data.elasticsearch.client.TransportClientFactoryBean.buildClient(TransportClientFactoryBean.java:89)
at org.springframework.data.elasticsearch.client.TransportClientFactoryBean.afterPropertiesSet(TransportClientFactoryBean.java:85)
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration.elasticsearchClient(ElasticsearchAutoConfiguration.java:59)
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$c145b8bd.CGLIB$elasticsearchClient$0(<generated>)
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$c145b8bd$$FastClassBySpringCGLIB$$d05a5aad.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$c145b8bd.elasticsearchClient(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 69 common frames omitted
Do you guys have any clue why it isn't running successfully? Thank you!
Hey guys, where you able to solve this issue? I'm facing the exact same problem and I can't find a workaround!
Thanks, Julio
@julillosamaral @nammmm @rfanjul
Sorry, I missed all the comments until now.
Have you tried what me and @FlatsWire-Niko have written a couple of comments above? We both seem to have found solutions, albeit sort of specific ones.
@CGavrila Ok, I was using gradle instead of maven. The thing is that even though I use the same dependencies gradle resolves them differently and that's the issue.
After I update my gradle with the correct dependencies I'll add it here.
Thanks for your help!
@FlatsWire-Niko Can you please share the sample working code with dependencies ?
Hi @CGavrila, @sathishece170, @nammmm
I'll try to add a quick project on GitHub soon and I come back to you quickly.
hello - sorry for the delay ... for me is already working with 2.0.0.M7 :) 👍
@rfanjul - Can you share the dependencies with versions ?
Sorry for the delay @sathishece170 in my pom I added:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>...</name>
<description>...</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M7</version>
</parent>
<properties>
<java.version>1.8</java.version>
<maven.test.skip>false</maven.test.skip>
<elasticsearch.version>5.6.0</elasticsearch.version>
<spring>2.0.0.M7</spring>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
<version>2.0.0.M2</version>
</dependency>
<!-- data -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.0.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<exclusions>
<exclusion>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>5.6.0</version>
</dependency>
.....
And as I said I need XPackTransport so I also created this template:
@Configuration
@EnableElasticsearchRepositories(basePackages = "example.repositories.elasticsearch")
public class ElasticSearchConfig {
@Value("${spring.elasticsearch.cluster_name}")
private String clusterName;
@Value("${spring.elasticsearch.user}")
private String user;
@Value("${spring.elasticsearch.password}")
private String password;
@Value("${spring.elasticsearch.host}")
private String host;
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
System.setProperty("es.set.netty.runtime.available.processors", "false");
Settings settings = Settings.builder()
.put("cluster.name", clusterName )
.put("xpack.security.user", user + ":" + password )
.build();
TransportClient client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress( new InetSocketTransportAddress(new InetSocketAddress(host, 9300)) );
return new ElasticsearchTemplate(client);
}
}
Let me know if it works for you
Hello,
Sorry to bother you by making an issue. I don't know how to contact you in Github. Have you found any solution on this ES issue ?
I'm facing the same and I spent 2h searching the Internet for a solution. Without success. So I've switched back to 2.0.4 which work well. I'm trying to setup a project with version 5.5.0 of ES.
I've tried any combinaisons of version without success...
Kind regards, Nicolas