【问题标题】:Elastic Search, match multiple terms on one string弹性搜索,在一个字符串上匹配多个术语
【发布时间】:2014-11-25 10:25:29
【问题描述】:

首先,我正在关注位于here 的弹性搜索教程。我正在尝试使用多个查询字符串执行搜索。

我的索引有几个字段,但我感兴趣的是“路径”。

我知道我至少有这条路

path: "ops/TopRelation/...."

在我的索引中。我已经确认了。

为什么这个查询什么也没返回。

{
    "query":{
        "match":{
            "path":{
                "query": "ops toprelation", 
                "operator": "and"
            }
        }
    }
}

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

{
    "query": {
        "bool": {
            "must": [
                { "match": { "path": "ops" }},
                { "match": { "path": "toprelation" }}
            ]
        }
    }
}

我以为顶部查询基本上是在内部使用底部查询?的确,教程中的例子似乎表明this

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.

【问题讨论】:

    标签: indexing elasticsearch full-text-search match multi-term


    【解决方案1】:

    如果你在“运算符”中使用“or”而不是“and”,它会返回任何结果吗?

    请您分享该索引的映射。

    GET <IndeName>/<Type>/_mapping
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-12
      • 1970-01-01
      • 2014-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多