java.lang.IllegalStateException: Failed to introspect Class

You need to add spring-data-elasticsearch.jar file into your class path. The error is showing because of this small mistake.


Caused by: java.lang.ClassNotFoundException: org.springframework.data.elasticsearch.core.ElasticsearchOperations

This error message means that the jar containing this class is not on the application classpath.

Add spring-data-elasticsearch jar to it, and your error should be gone.

if you are using maven, add the jar to the classpath this way :

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-elasticsearch</artifactId>
    <version>3.2.5.RELEASE</version>
</dependency>

The version that you should use depends on the version of elastic search you are connecting to :

+--------------+----------------------------+----------------+-------------+
| Spring Data  | Spring Data Elasticsearch  | Elasticsearch  | Spring Boot |
+--------------+----------------------------+----------------+-------------+
| 2021.1       | 4.3.x                      |         7.15.2 | 2.5.x       |
| 2021.0       | 4.2.x                      |         7.12.0 | 2.5.x       |
| 2020.0.0     | 4.1.x                      |          7.9.3 | 2.3.x       |
| Neumann      | 4.0.x                      |          7.6.2 | 2.3.x       |
| Moore        | 3.2.x                      |          6.8.4 | 2.2.x       |
| Lovelace     | 3.1.x                      |          6.2.2 | 2.1.x       |
| Kay          | 3.0.x                      |          5.5.0 | 2.0.x       |
| Ingalls      | 2.1.x                      |          2.4.0 | 1.5.x       |
+--------------+----------------------------+----------------+-------------+

(source : https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions )