I am using 'elasticsearch-rest-client:8.3.3' to connect elasticsearch using java low level rest client. Is there a way to use ElasticsearchRepository (@Document annotation) when using low level rest client. I know it is possible when using High Level Rest Client as below
//Repository class
@Repository
public interface MessageRepository extends ElasticsearchRepository<DemoMessage, Long> {}
//Configuration class
@Configuration
@EnableElasticsearchRepositories(basePackages = "com.demo.elasticsearch.repositories")
@ComponentScan(basePackages = {"com.demo.elasticsearch"})
public class ElasticSearchConfiguration {
@Bean
public RestHighLevelClient elasticsearchClient() {...}
}
Repository comes from Spring Data Elasticsearch and not High Level Rest Client.
The Low Level Rest Client is – as its name implies – low level. So it only deals with raw http requests and responses. So no, no repository at that level.
So it is not possible to use spring-boot-starter-data-elasticsearch features when using low level rest client? Is there a way to send request like below using low level client.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.