如何使用前缀查询编写匹配查询 OR
How to write a match query OR with a prefix query
例如,如果有一个字符串 "nite out",现在我希望我的字符串与 "nite" 匹配或将其前缀与 "out" 匹配,因此对于上述字符串,评分必须类似于第一个 "nite out"、"nite outing"、"nite" 和 "out" 优先级相同,"outing".
下面提到的两个查询都将匹配 "nite out" 和 "nite outing"
"With Default AND Operator"
POST YourIndex/YourType/_search
{
"query": {
"query_string": {
"query": "nite AND out*"
}
}
}
"With OR Operator"
POST YourIndex/YourType/_search
{
"query": {
"query_string": {
"query": "nite OR out*"
}
}
}
例如,如果有一个字符串 "nite out",现在我希望我的字符串与 "nite" 匹配或将其前缀与 "out" 匹配,因此对于上述字符串,评分必须类似于第一个 "nite out"、"nite outing"、"nite" 和 "out" 优先级相同,"outing".
下面提到的两个查询都将匹配 "nite out" 和 "nite outing"
"With Default AND Operator"
POST YourIndex/YourType/_search
{
"query": {
"query_string": {
"query": "nite AND out*"
}
}
}
"With OR Operator"
POST YourIndex/YourType/_search
{
"query": {
"query_string": {
"query": "nite OR out*"
}
}
}