当使用Elastic search的lowercase token 生成器时,它会在遇到非字母字符时将文本转换为小写,并将文本分解为术语。

我不希望在遇到非字母时将文本分解为术语。

我研究了standardletter标记生成器-试图寻找一种构建自定义标记生成器的方法,但徒劳无功。

示例:当使用Postgres9标记生成器将lowercase用作输入时,它会转换为['postgres','9'],但我需要的是['postgres9'](转换为小写而不拆分非字母)

最佳答案

您应该看一下 token 过滤器。
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenfilters.html

这样的事情应该做:

POST _analyze
{
  "tokenizer": "standard",
  "filter":  [ "lowercase"],
  "text":      "ABC4def pqr6LMN Postgres9"
}

07-24 09:39
查看更多