Elasticsearch:Phrase Suggester - 第一个字符出错

时间:2018-06-15 13:10:50

标签: elasticsearch spell-checking search-suggestion phrase

我有以下弹性搜索(6.2)查询。一切都按预期工作,但我不会得到任何关于第一个字符错误的建议(如下所示)。如果我输入inustrie,我会收到industrie之类的建议。如果我输入jndustrie,我将不会收到任何建议。

有没有办法将此功能添加到我的查询中?

谢谢!

GET jobs/_search
{
  "suggest": {
    "text": "jndustrie",
    "multi_phrase": {
      "phrase": {
        "field": "all",
        "size": 5,
        "gram_size": 3,
        "collate": {
          "query": {
            "source": {
              "bool": {
                "must": [
                  {
                    "match_all": {}
                  }
                ],
                "filter": {
                  "multi_match": {
                    "query": "{{suggestion}}",
                    "type": "cross_fields",
                    "fields": [
                      "field1",
                      "field2",
                      "field3"
                    ],
                    "operator": "AND",
                    "lenient": true
                  }
                }
              }
            }
          },
          "params": {
            "field_name": "all"
          }
        }
      }
    }
  }
}

0 个答案:

没有答案