2

I have a springboot app which connects to ElasticSearch. However I would like to use ElasticsearchRestTemplate and I get only classNotFound.

My pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-elasticsearch</artifactId>
                <version>3.1.2.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
            </dependency>
     <dependencies>

And when I try to do import

import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;

It shows that the class does not exist. How to solve that ? Which version of Spring Elasticsearch Data to be able to use ElasticsearchRestTemplate ?

1 Answer 1

1

ElasticsearchRestTemplate is part of release 4 of Spring Data ES which is still under development.

If you want to try it out (i.e. not in production) you can use the 4.0.0.BUILD-SNAPSHOT version.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot @val. I am new to elastic search, could you please tell me what is the difference between elasticsearchtemplate and elasticsearchresttemplate? which one to use in springboot project ?
@implosivesilence feel free to ask a new question, this one is closed already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.