我正在尝试从给定的大学和名称中选择用户.在此名称具有模糊查询.
以下是弹性搜索(v5.1.2)中的查询,该查询为我提供了所需的结果.但是在Java中给出了一个错误
{
"query" : {
"bool": {
"must" : [{
"match": {
"collegeAccountCode": "DIT"
}
},
{
"match": {
"name" : {
"query": "Rahul",
"fuzziness" : "AUTO"
}
}
}]
}
}
}
我尝试使用以下Java API(v5.1.2)来实现此目的
QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("name", studentName).fuzziness())
.must(QueryBuilders.matchQuery("collegeAccountCode", AccountId));
但我收到一条错误消息:
"The method must(QueryBuilder) in the type BoolQueryBuilder is not applicable for the arguments
(Fuzziness)"
如何解决此错误,或者还有其他方法可以实现此查询?