V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jiangxinyu226
V2EX  ›  Elasticsearch

ElasticSearch 如何精确匹配?

  •  
  •   jiangxinyu226 · 2015-05-24 23:16:41 +08:00 · 8842 次点击
    这是一个创建于 3231 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如有两个doc,name字段一个是abc,另一个是abc 2,不管用match_phrase还是match还是term搜索,都是abc 2排在前面。
    我只想要abc那个如何搜索?

    6 条回复    2015-05-27 22:48:57 +08:00
    cevincheung
        1
    cevincheung  
       2015-05-24 23:20:57 +08:00
    not_analyzer
    cevincheung
        2
    cevincheung  
       2015-05-24 23:22:52 +08:00
    multi_field
    czheo
        3
    czheo  
       2015-05-24 23:23:40 +08:00
    jiangxinyu226
        4
    jiangxinyu226  
    OP
       2015-05-25 00:25:19 +08:00
    @czheo
    @cevincheung
    没懂啊。我想像数据库一样搜索 这么复杂啊
    RemRain
        5
    RemRain  
       2015-05-25 01:01:24 +08:00
    设置 analyzer 为 not_analyzed,然后用 term 搜索。如果是 match 搜索的话,设置 type 为 phrase
    jiangxinyu226
        6
    jiangxinyu226  
    OP
       2015-05-27 22:48:57 +08:00
    @RemRain 解决了 谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2803 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:54 · PVG 20:54 · LAX 05:54 · JFK 08:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.