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

elasticsearch phrase suggester 得不到任何结果,小白想请教一下

  •  
  •   SjwNo1 · 2020-12-10 17:35:21 +08:00 · 2010 次点击
    这是一个创建于 1448 天前的主题,其中的信息可能已经有所发展或是发生改变。
    • index 配置
      settings:
    "settings": {
            "index": {
                "creation_date": "1607592412988",
                "number_of_shards": "1",
                "number_of_replicas": "1",
                "uuid": "L_Z-Y-YlRiWiD5gnPWftSg",
                "version": {"created": "7090299"},
                "provided_name": "repository_index",
            }
        }
    

    mappings:

    "mappings": {
            "_doc": {
                "properties": {
                    "type_num": {"type": "integer"},
                    "creator_id": {"type": "integer"},
                    "name": {"analyzer": "ik_max_word", "type": "text"},
                    "team_id": {"type": "integer"},
                }
            }
        }
    
    • 文档数据(只有 1 条)
    {
        "_index": "repository_index",
        "_type": "_doc",
        "_id": "1",
        "_version": 1,
        "_score": 1,
        "_source": {"creator_id": 6, "team_id": 2, "type_num": 2, "name": "测试数据"},
    }
    
    • phrase suggest
    POST _search
    {
      "suggest": {
        "my_suggestion": {
          "text": "测试",
          "term": {
            "field": "name"
          }
        }
      }
    }
    
    • 搜索结果
    {
      "took" : 1,
      "timed_out" : false,
      "_shards" : {
        "total" : 6,
        "successful" : 6,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : {
          "value" : 0,
          "relation" : "eq"
        },
        "max_score" : null,
        "hits" : [ ]
      },
      "suggest" : {
        "my_suggestion" : [
          {
            "text" : "测试",
            "offset" : 0,
            "length" : 2,
            "options" : [ ]
          }
        ]
      }
    }
    
    
    • 问题
      没有查询到 “测试数据”? 目前猜测是 ik 分词的问题,请教一下是哪里出错了或者配置有问题吗
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5397 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 07:51 · PVG 15:51 · LAX 23:51 · JFK 02:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.