【问题标题】:search suggestions and elasticsearch multi-field搜索建议和elasticsearch多字段
【发布时间】:2016-05-18 14:10:55
【问题描述】:

如果我尝试使用 ES match_phrase_prefix here 查询来获取搜索建议,但我想使用多字段...可以做到吗?我试图在文档中找到这个答案,但似乎找不到。

【问题讨论】:

  • 对于多字段搜索,您需要在创建分析器类型时设置分析器。看不懂?回复。
  • @AbdullaAlSun,所以在映射中,我应该为索引和搜索设置分析器 - 你是这么说的吗?
  • 对于您要使用 match_phrase_prefix 搜索的每个字段,您需要设置分析器。

标签: elasticsearch


【解决方案1】:

你可以试试:

"query":{
        "bool":{
              "should":[
                      {"match_phrase_prefix":{"field1":"search"}}
                      {"match_phrase_prefix":{"field2":"search"}},
                      {"match_phrase_prefix":{"field3":"search"}}
               ]
         }
},

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 1970-01-01
    • 2015-03-08
    相关资源
    最近更新 更多