如何根据我在Elasticsearch中的当前映射添加“完成建议”?

时间:2019-01-22 10:10:35

标签: elasticsearch mapping kibana

例如,我尝试将其用于我的网站以添加建议程序: 如果我搜索:“ JO” 自动补全添加:

  • “约翰·威克”
  • “乔希·布莱恩”
  • “乔纳森·威廉姆斯”

我已经看过https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-suggesters-completion.html中的示例,但是我不知道该如何使用,谢谢您的帮助

{
  "blog_pro" : {
    "mappings" : {
      "data" : {
        "properties" : {
          "@timestamp" : {
            "type" : "date"
          },
          "@version" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "commentaire" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "id" : {
            "type" : "long"
          },
          "nom" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "prenom" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "testField" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }
  }
}

0 个答案:

没有答案