自动提取整数在弹性搜索中不起作用

时间:2017-01-31 09:12:38

标签: elasticsearch elasticsearch-plugin

我正在使用完成建议器如下。 数字autosuggest存在问题

index : {
        "_index": "mysuggestors",
        "_type": "suggest",
        "_id": "584a4455",
        "_score": 1,
        "_source": {
          "name": "Test  100AH 200 Title",
          "suggest": {
            "input": [
              "Test",
              "100AH",
              "200",
              "100",
              "200 Title",
              "Titl",
            ],
            "output": "Test  100AH 200 Title",
            "payload": {
              "id": "584a4455"
            },
            "weight": 10
          }
        }
      }

case 1.
autosuggest query : 

{"suggestions": {
  "text": "100",
  "completion": {"field": "suggest"}
}}

response :  empty response


case 2.
autosuggest query : 

{"suggestions": {
  "text": "100A",
  "completion": {"field": "suggest"}
}}

response : valid response


case 3.
autosuggest query : 

{"suggestions": {
  "text": "Tes",
  "completion": {"field": "suggest"}
}}

response : valid response

1 个答案:

答案 0 :(得分:0)

您可以在查询中为完成建议者设置分析器。

默认情况下,分析仪是简单分析器,仅对字母进行标记。

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

我相信你需要标准分析仪 -

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