ElasticSearch 的 BoolQueryBuilder 使用

admin2024-06-06  17

ElasticSearch的BoolQueryBuilder定义:

A Query that matches documents matching boolean combinations of other queries

import org.elasticsearch.index.query.QueryBuilders;

BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
for (String word : wordList) {
    boolQueryBuilder.should(QueryBuilders.termQuery(FIELD1, word));
    boolQueryBuilder.should(QueryBuilders.termQuery(FIELD2, word));
}


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!