如何将下面的接口转换为最新的TermsQuery.builder
https://www.javadoc.io/doc/org.elasticsearch/elasticsearch/7.2.0/org/elasticsearch/index/query/QueryBuilders.html#termsQuery(java.lang.String,java.util.Collection).下面给出了现有代码
List<String> ids;
TermsQueryBuilder idsQb = QueryBuilders.termsQuery("id", ids);
NativeSearchQuery query = new NativeSearchQueryBuilder()
.withSourceFilter(new FetchSourceFilterBuilder()
.withPageable(pageable).withQuery(idsQb).build();
SearchHits<Profile> searchHits = esRestTemplate.search(query, Profile.class);
我正在尝试将上面的函数转换为下面的接口
https://javadoc.io/doc/co.elastic.clients/elasticsearch-java/latest/co/elastic/clients/elasticsearch/_types/query_dsl/TermsQuery.Builder.html
我没有看到一种方法来传递一个id的列表给这个函数
https://javadoc.io/static/co.elastic.clients/elasticsearch-java/8.7.1/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.html#terms(java.util.function.Function)
1条答案
按热度按时间66bbxpm51#
没有运行它,但应该是这样的: