我正在尝试使用QueryBuilders
构建此json,但是"查询" json缺少关键,有人可以帮帮我吗?
{
"query": {
"bool": {
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1.0
}
}
}
答案 0 :(得分:0)
对于query
换行,您可以将SearchSourceBuilder
与QueryBuilder
一起使用,也可以像:
BoolQueryBuilder must = boolQuery().adjustPureNegative(true).disableCoord(false).boost(1.0f)
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(must);
XContentBuilder xContentBuilder = jsonBuilder();
searchSourceBuilder.toXContent(xContentBuilder, ToXContent.EMPTY_PARAMS);
System.out.println(xContentBuilder.string());