I am trying to implement the selection of users from a given college and name. Here the name has fuzzy query. Following is the query in elastic search (v5.1.2) which gives me the desired result. But gives an error in Java
{
"query" : {
"bool": {
"must" : [{
"match": {
"collegeAccountCode": "DIT"
}
},
{
"match": {
"name" : {
"query": "Rahul",
"fuzziness" : "AUTO"
}
}
}]
}
}
}
I tried to implement this using following java API (v5.1.2)
QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("name", studentName).fuzziness())
.must(QueryBuilders.matchQuery("collegeAccountCode", AccountId));
But I get an error saying :
"The method must(QueryBuilder) in the type BoolQueryBuilder is not applicable for the arguments
(Fuzziness)"
How to fix this error or is there any other way to implement this query ?