如何在elasticsearch中正确使用带有asterisk_pattern的星号?

时间:2018-11-01 09:24:58

标签: elasticsearch elastic-stack elasticsearch-5

我要使用Keyword Marker Token Filter

但是我不明白如何编写有效的keyword_pattern。我从这样的示例中修改代码

{
  "settings": {
    "analysis": {
      "analyzer": {
        "protect_cats": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["lowercase", "protect_cats", "porter_stem"]
        },
        "normal": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["lowercase", "porter_stem"]
        }
      },
      "filter": {
        "protect_cats": {
          "type": "keyword_marker",
          "keywords_pattern": ".*\\*"
        }
      }
    }
  }
}

并通过put请求将其放入test_index。我希望elasticsearch执行后会返回令牌“ cats *”或至少“ cats”

  

/ _ analyze?text = cats *&analyzer = protect_cats

但是我得到了“ cat”令牌。如何达到预期的效果?弹性版本5.6.11。谢谢。

0 个答案:

没有答案