代码之家  ›  专栏  ›  技术社区  ›  OussamaM

Elasticsearch查询:在句子数组中匹配单词

  •  0
  • OussamaM  · 技术社区  · 7 年前

    "fields": {
               "title": [
                  "The book of the world"
               ]
            }
    

    简单查询“book”不会返回预期结果:

    GET catalog/_search
      {
        "fields" : "title",
        "query":{
           "match" : {
              "title":"book"
           }
         }
    }
    

    你有什么想法吗?

    2 回复  |  直到 7 年前
        1
  •  1
  •   Thomas Decaux    7 年前

    分析器是将句子“拆分”为标记的东西(这里是:“世界”的“书”或删除停止词“书”“世界”)。

    https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html

    https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html

        2
  •  1
  •   Thomas Decaux    7 年前

    尝试:

    GET catalog/_search
    {
        "fields" : "fields.title",
        "query":{
           "match" : {
              "fields.title":"book"
           }
         } 
    }