我有以下运行的查询,但没有返回正确的结果。返回的结果全部不包含查询中请求的单词(none中不包含请求的单词)。它可能与查询的“字段”部分有关,但如果没有匹配则不应该返回任何内容?
{
"fields": ["id", "author", "authorId"],
"query": {
"bool": {
"must": [{
"match": {
"content": "dog"
}
}],
"filter": [{
"term": {
"sourceOriginator": "Twitter"
}
}, {
"range": {
"estimatedDate": {
"gte": "2016-07-24T18:14:36.000Z",
"lte": "2016-07-25T18:14:38.000Z"
}
}
}]
}
}
}
答案 0 :(得分:0)
正确的方法是使用multi_match
{
"fields": ["id", "author", "authorId"],
"query": {
"bool": {
"must": [{
"multi_match": {
"query": "dog",
"fields": ["id", "author", "authorId","content"]
}
}],
"filter": [{
"term": {
"sourceOriginator": "Twitter"
}
}, {
"range": {
"estimatedDate": {
"gte": "2016-07-24T18:14:36.000Z",
"lte": "2016-07-25T18:14:38.000Z"
}
}
}]
}
}
}