[英]elasticsearch Full Text Search all fields with start and end time
我有以下查詢正在運行,但沒有返回正確的結果。 返回的結果全部不包含查詢中所請求的單詞(都不包含所請求的單詞)。 它可能與查詢的“字段”部分有關,但是如果沒有匹配項,它不應該不返回任何內容嗎?
{
"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"
}
}
}]
}
}
}
正確的方法是使用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"
}
}
}]
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.