如何在我的查询中添加过滤器,以获得role admin
?
这是我的问题:
userModel.search({
"multi_match": {
"fields": ["firstName", 'lastName', 'specialities', 'profession', 'country', 'state', 'city'],
"query": req.query.q,
"fuzziness": "AUTO"
}
},
{
from: (pageNum - 1) * perPage,
size: perPage
},
function (err, results) {
...
我需要用mognoosastic做这样的事情: ElasticSearch - multi-match with filter - returns no result
答案 0 :(得分:0)
尝试以下查询格式
"query": {
"bool": {
"must": {
"multi_match": {
"query": "values",
"fields": [
"filed_one","field_two"
]
}
},
"filter": {
"range": {
"field_name": {
"gte": 1467311400,
"lte": 1468866599
}
}
}
}
}
如果此格式有帮助,请告诉我