I've implemented the Specification pattern for filtering some of my JpaRepositories. After I have implemented a Specification, I can use it with a JpaRepository like this:
Page<Entity> page = entityJpaRepository.findAll(entitySpecification, pageable)
Is there a feature, or planned feature, for supporting Specifications in ElasticsearchRepository?
The ElasticsearchTemplate class is deprecated as it uses the TransportClient to access Elasticsearch, which itself is deprecated since Elasticsearch version 7. + Users should switch to ElasticsearchRestTemplate or ReactiveElasticsearchTemplate .
Spring Data for Elasticsearch is part of the umbrella Spring Data project which aims to provide a familiar and consistent Spring-based programming model for for new datastores while retaining store-specific features and capabilities.
Spring Data Elasticsearch comes with three interfaces that supports reactive operations: ReactiveRepository , ReactiveCrudRepository that adds save/update operations, and ReactiveSortingRepository offering some methods with sorting.
Elasticsearch Repository It will detect issues and improve your Elasticsearch performance by analyzing your shard sizes, threadpools, memory, snapshots, disk watermarks and more.
I understand your pain however the thing is that Specification
interface belongs to the JPA API that currently none of the Elastic Search Spring Data repositories implement and I don't think they will.
If you really want to use them you should rather migrate from ElasticsearchRepository coming from spring-data-elasticsearch into JPA-based repositories.
Did not try to use JPA together with ElasticSearch myself but noticed that some people does it, check out this link:
https://programmertoday.com/spring-boot-elastic-search-with-spring-data-jpa/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With