I have this query:
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(multiMatchQuery(searchPattern)
.field("fullName")
.field("npi")
.type(MultiMatchQueryBuilder.Type.BEST_FIELDS))
.build();
How can I run it? All methods in the ElasticsearchRepository are deprecated:
public interface ElasticsearchRepository<T, ID> extends PagingAndSortingRepository<T, ID> {
/** @deprecated */
@Deprecated
default <S extends T> S index(S entity) {
return this.save(entity);
}
/** @deprecated */
@Deprecated
<S extends T> S indexWithoutRefresh(S var1);
/** @deprecated */
Iterable<T> search(QueryBuilder var1);
/** @deprecated */
Page<T> search(QueryBuilder var1, Pageable var2);
/** @deprecated */
Page<T> search(Query var1);
Page<T> searchSimilar(T var1, @Nullable String[] var2, Pageable var3);
/** @deprecated */
@Deprecated
void refresh();
}
The Javadoc for the deprecated methods states that you should
@Query annotation wit a query stringElasticsearchOperations to pass your custom Query derived queries.We deprecated the methods from the repository interface that use the Queryclasses. Not only in Spring Data Elasticsearch, but we do not intorduce them in other modules as well; see the comment on this Spring Data Mongo issue for more information.
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