首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >弹性搜索,在一个字符串上匹配多个术语

弹性搜索,在一个字符串上匹配多个术语
EN

Stack Overflow用户
提问于 2014-10-01 01:38:29
回答 1查看 746关注 0票数 0

首先,我将跟随位于here的elastic search教程。我正在尝试使用多个查询字符串执行搜索。

我的索引有几个字段,但我感兴趣的是"path“。

我知道我至少有这条路

代码语言:javascript
运行
复制
path: "ops/TopRelation/...."

在我的索引里。我已经证实了这一点。

为什么这个查询不会返回任何东西。

代码语言:javascript
运行
复制
{
    "query":{
        "match":{
            "path":{
                "query": "ops toprelation", 
                "operator": "and"
            }
        }
    }
}

但是这个查询返回了我期望的结果。

代码语言:javascript
运行
复制
{
    "query": {
        "bool": {
            "must": [
                { "match": { "path": "ops" }},
                { "match": { "path": "toprelation" }}
            ]
        }
    }
}

我以为top查询基本上就是内部使用了bottom查询的查询?实际上,本教程中的示例似乎表明了this

代码语言:javascript
运行
复制
Because the match query has to look for two terms — ["brown","dog"] — internally it
has to execute two term queries and combine their individual results into the overall 
result. To do this, it wraps the two term queries in a bool query, which we will 
examine in detail in Combining queries below.
EN

回答 1

Stack Overflow用户

发布于 2014-10-01 03:38:35

如果在"operator“中使用"or”而不是"and“,是否会返回任何结果?

您能分享一下该索引的映射吗?

代码语言:javascript
运行
复制
GET <IndeName>/<Type>/_mapping
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26126808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档