在 query_string 弹性搜索中搜索多个值
search multiple value in query_string Elastic search
我在弹性中使用这些查询,但问题是当我替换值时,我得到一些不同的结果,或者当我单独使用每个词时,我们有不同的 result.here 是我查询的一部分
"query_string" : {
"query" : "businessId : 1848 4335",
"fields" : []
}
result : "hits": {"total": 81,....}
替换 businessId 时:
"query_string" : {
"query" : "businessId : 4335 1848",
"fields" : []
}
result : "hits": {"total": 162,...}
当我搜索“4335”时
"query_string" : {
"query" : "businessId : 4335",
"fields" : []
}
result : "hits": {"total": 0,...}
搜索“1848”
"query_string" : {
"query" : "businessId : 1848",
"fields" : []
}
result : "hits": {"total": 14,...}
当我在字段中使用 "businessId" 时
"query_string" : {
"query" : "4335 1848",
"fields" : ["businessId"]
}
result : "hits": {"total": 14,...}
我很困惑为什么会出现这些结果?
docs 对此非常清楚:
或者
{
"query": {
"query_string": {
"query": "businessId:4335 OR businessId:1848"
}
}
}
或
{
"query": {
"query_string": {
"query": "businessId:(4335 OR 1848)"
}
}
}
我在弹性中使用这些查询,但问题是当我替换值时,我得到一些不同的结果,或者当我单独使用每个词时,我们有不同的 result.here 是我查询的一部分
"query_string" : {
"query" : "businessId : 1848 4335",
"fields" : []
}
result : "hits": {"total": 81,....}
替换 businessId 时:
"query_string" : {
"query" : "businessId : 4335 1848",
"fields" : []
}
result : "hits": {"total": 162,...}
当我搜索“4335”时
"query_string" : {
"query" : "businessId : 4335",
"fields" : []
}
result : "hits": {"total": 0,...}
搜索“1848”
"query_string" : {
"query" : "businessId : 1848",
"fields" : []
}
result : "hits": {"total": 14,...}
当我在字段中使用 "businessId" 时
"query_string" : {
"query" : "4335 1848",
"fields" : ["businessId"]
}
result : "hits": {"total": 14,...}
我很困惑为什么会出现这些结果?
docs 对此非常清楚:
或者
{
"query": {
"query_string": {
"query": "businessId:4335 OR businessId:1848"
}
}
}
或
{
"query": {
"query_string": {
"query": "businessId:(4335 OR 1848)"
}
}
}