Elasticsearch: [Springboot]Rest High Level Client 7.0 can't use search method, missing org.elasticsearch.action.search.SearchRequest

Created on 15 Apr 2019  路  16Comments  路  Source: elastic/elasticsearch

I use Elasticsearch 7.0 (Latest Release) fresh new installing scratch without any upgrade from previous version. But I confront the problem when I try to use searching method.
It said that can't find org.elasticsearch.action.search.SearchRequest.
Spring Boot: 2.1.3.
Elasticsearch: 7.0
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-getting-started-maven.html

image

image

image

image

An attempt was made to call the method org.elasticsearch.action.search.SearchRequest.isCcsMinimizeRoundtrips()Z but it does not exist. Its class, org.elasticsearch.action.search.SearchRequest


2019-04-15 16:49:32.710 INFO 10024 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8585
2019-04-15 16:49:33.923 INFO 10024 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8585. Will be trying the next url if available
2019-04-15 16:49:33.923 WARN 10024 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8585/eventservice/dev": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2019-04-15 16:49:33.927 INFO 10024 --- [ restartedMain] meetu.eventservice.EventApplication : The following profiles are active: dev
2019-04-15 16:49:35.784 INFO 10024 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-04-15 16:49:35.865 INFO 10024 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 74ms. Found 1 repository interfaces.
2019-04-15 16:49:36.025 WARN 10024 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2019-04-15 16:49:36.676 INFO 10024 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=f2bca617-8dd7-3ecd-b3de-930b00a90448
2019-04-15 16:49:36.998 INFO 10024 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$d500f354] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-15 16:49:38.542 INFO 10024 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3002 (http)
2019-04-15 16:49:38.592 INFO 10024 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-04-15 16:49:38.592 INFO 10024 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-04-15 16:49:38.624 INFO 10024 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_171\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\PuTTY\;C:\JMeter\bin;C:\Program Files\Java\jre1.8.0_171\bin;C:\Users\wdrdr\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Dart\dart-sdk\bin;C:\Program Files (x86)\Google\Chrome\Application;C:\Program Files\IBM\Cloud\bin;C:\Program Files\Java\jdk1.8.0_171\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\ProgramData\chocolatey\bin;C:\Program Files\Cloud Foundry;C:\Program Files\OpenVPN\bin;C:\gradle-5.3.1\bin;C:\Go\bin;C:\Users\wdrdr\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\wdrdr\AppData\Local\Programs\Python\Python36\;C:\Users\wdrdr\AppData\Local\Microsoft\WindowsApps;C:\Users\wdrdr\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Users\wdrdr\AppData\Local\Yarn\bin;C:\Program Files\Docker Toolbox;C:\flutter\bin;C:\Program Files\apache-maven-3.5.4\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\heroku\bin;C:\Go\bin;C:\Users\wdrdr\go\bin;D:\ProjectCode\monstache\windows-amd64;C:\Users\wdrdr.git-secrets;C:\Users\wdrdr\go\bin;.]
2019-04-15 16:49:38.942 INFO 10024 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-04-15 16:49:38.943 INFO 10024 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4985 ms
2019-04-15 16:49:39.275 WARN 10024 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-04-15 16:49:39.275 INFO 10024 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-04-15 16:49:39.303 INFO 10024 --- [ restartedMain] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@4e7051c3
2019-04-15 16:49:40.940 INFO 10024 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[137.116.148.122:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2019-04-15 16:49:40.940 INFO 10024 --- [ restartedMain] org.mongodb.driver.cluster : Adding discovered server 137.116.148.122:27017 to client view of cluster
2019-04-15 16:49:41.203 INFO 10024 --- [6.148.122:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:285}] to 137.116.148.122:27017
2019-04-15 16:49:41.257 INFO 10024 --- [6.148.122:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=137.116.148.122:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 9]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=48410200}
2019-04-15 16:49:41.260 INFO 10024 --- [6.148.122:27017] org.mongodb.driver.cluster : Discovered cluster type of STANDALONE
2019-04-15 16:49:42.757 INFO 10024 --- [ restartedMain] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:286}] to 137.116.148.122:27017
2019-04-15 16:49:45.450 WARN 10024 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
Starting Configuration
org.elasticsearch.client.RestHighLevelClient@74ea932c
DESKTOP-PPV70M1
QcQaiLakT66vkBV26hIrZA
true
2019-04-15 16:49:46.108 WARN 10024 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventController': Unsatisfied dependency expressed through field 'eventService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventService': Unsatisfied dependency expressed through field 'restHighLevelClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restHighLevelClient' defined in class path resource [meetu/eventservice/config/ElasticConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.RestHighLevelClient]: Factory method 'restHighLevelClient' threw exception; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.action.search.SearchRequest.isCcsMinimizeRoundtrips()Z
2019-04-15 16:49:46.114 INFO 10024 --- [ restartedMain] org.mongodb.driver.connection : Closed connection [connectionId{localValue:2, serverValue:286}] to 137.116.148.122:27017 because the pool has been closed.
2019-04-15 16:49:46.122 INFO 10024 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-04-15 16:49:46.143 INFO 10024 --- [ restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-15 16:49:46.148 ERROR 10024 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

An attempt was made to call the method org.elasticsearch.action.search.SearchRequest.isCcsMinimizeRoundtrips()Z but it does not exist. Its class, org.elasticsearch.action.search.SearchRequest, is available from the following locations:

jar:file:/C:/Users/wdrdr/.m2/repository/org/elasticsearch/elasticsearch/6.4.3/elasticsearch-6.4.3.jar!/org/elasticsearch/action/search/SearchRequest.class

It was loaded from the following location:

file:/C:/Users/wdrdr/.m2/repository/org/elasticsearch/elasticsearch/6.4.3/elasticsearch-6.4.3.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.action.search.SearchRequest


pom.xml


xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

org.springframework.boot
spring-boot-starter-parent
2.1.3.RELEASE


com.meetu
event
0.0.1-SNAPSHOT
EventService
Demo project for Spring Boot

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>7.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <!-- Dependency For Generate QR Code -->
    <dependency>
        <groupId>com.google.zxing</groupId>
        <artifactId>core</artifactId>
        <version>3.3.3</version>
    </dependency>
    <dependency>
        <groupId>com.google.zxing</groupId>
        <artifactId>javase</artifactId>
        <version>3.3.0</version>
    </dependency>
    <!-- Core Of Spring Framework-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

:CorFeatureJava High Level REST Client feedback_needed

Most helpful comment

Just pasting here the answer I gave on discuss as I can see that a lot of people (including myself) are hitting this problem. I'm sure we will have lot of new opened issues in the near future.

When using springboot with
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:

<properties>
  <elasticsearch.version>7.0.0</elasticsearch.version>
</properties>

See documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions

All 16 comments

Not sure where the elasticsearch 6.4.3 dependency has crept into your setup.
The elasticsearch high level rest client version 7 has a dependency on elasticsearch version 7

I'm assuming the 6.4.3 version has been introduced by something else in your environment?

Pinging @elastic/es-core-features

Does it have anyway to check or verify enviroment like this ? Because I already delete maven repository cache but I still got elasticsearch 6.4.3 dependecy like this. So if enviroment is and everything correct I should got only Elasticsearch 7.0 dependency right ? then I will try it on my another computer.
image

Thanks very much for your interest in Elasticsearch.

This appears to be a user question, and we'd like to direct these kinds of things to the forums. If you can stop by there, we'd appreciate it. This allows us to use GitHub for verified bug reports, feature requests, and pull requests.

There's an active community in the forums that should be able to help get an answer to your question. As such, I hope you don't mind that I close this.

Just pasting here the answer I gave on discuss as I can see that a lot of people (including myself) are hitting this problem. I'm sure we will have lot of new opened issues in the near future.

When using springboot with
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:

<properties>
  <elasticsearch.version>7.0.0</elasticsearch.version>
</properties>

See documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions

hello,I had a similar problem,too.I have a solution.

 <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.elasticsearch</groupId>
                    <artifactId>elasticsearch</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.elasticsearch.client</groupId>
                    <artifactId>elasticsearch-rest-client</artifactId>
                </exclusion>
            </exclusions>
           </dependency>
     <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>7.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-client</artifactId>
        <version>7.0.0</version>
    </dependency>

@bobobo1114 Sure that works. I still think though that just defining:

<properties>
  <elasticsearch.version>7.0.0</elasticsearch.version>
</properties>

is easier IMHO.

@bobobo1114 Sure that works. I still think though that just defining:

<properties>
  <elasticsearch.version>7.0.0<elasticsearch.version>
</properties>

is easier IMHO.

it works, thanks

I had a similar problem. But the answer is only maven pom.xml version, so I share the gradle version.

ext {
    set('elasticsearch.version', '7.0.0')
}

Just pasting here the answer I gave on discuss as I can see that a lot of people (including myself) are hitting this problem. I'm sure we will have lot of new opened issues in the near future.

When using springboot with
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:

<properties>
  <elasticsearch.version>7.0.0<elasticsearch.version>
</properties>

See documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions

Wanted to point out one thing.. Make sure to close the tags
<elasticsearch.version>7.0.0</elasticsearch.version>

We encountered this problem today. Still not know where the 6.4.3 come from. Anyone got any idea?

For all seeing the same issue, I just found that spring boot is using 6.4.3 of elasticsearch. https://github.com/spring-projects/spring-boot/blob/2.1.x/spring-boot-project/spring-boot-dependencies/pom.xml#L64

my version is 7.3.0 ,has similar problem ,how to resolve

Even I am using 7.6.2 version and getting same error. Please suggest me how to resolve this issue.
My pom.xml is

org.elasticsearch.client
elasticsearch-rest-high-level-client
7.6.2


org.elasticsearch
elasticsearch
7.6.2

There are plenty of advices in this issue. See https://github.com/elastic/elasticsearch/issues/41189#issuecomment-483254425

I also faced the same issue::

Then below versions worked for me

<dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>6.7.1</version>
    </dependency>

    <dependency>
      <groupId>org.elasticsearch.client</groupId>
      <artifactId>elasticsearch-rest-high-level-client</artifactId>
      <version>6.7.1</version>
    </dependency>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ttaranov picture ttaranov  路  3Comments

matthughes picture matthughes  路  3Comments

clintongormley picture clintongormley  路  3Comments

dawi picture dawi  路  3Comments

rjernst picture rjernst  路  3Comments