gpt4 book ai didi

elasticsearch - 具有小写过滤器的自定义分析器无法正常工作

转载 作者:行者123 更新时间:2023-12-03 02:04:44 26 4
gpt4 key购买 nike

我有一个名为custom_raw_analyzer的简单自定义分析器,如下所示:

$ curl 'http://localhost:9200/test/_settings?pretty'

"test" : {
"settings" : {
"index" : {
"uuid" : "_M-KXnZSQXyFH7cqbh6lsw",
"number_of_replicas" : "1",
"analysis" : {
"analyzer" : {
"custom_raw_analyzer" : {
"type" : "custom",
"filters" : [ "lowercase" ],
"tokenizer" : "keyword"
}
}
},
"number_of_shards" : "5",
"refresh_interval" : "10s",
"version" : {
"created" : "1030499"
}
}
}
}
}

但是,当我对随机字符串进行测试时,输出 token 不是小写的:
$ curl -XGET 'localhost:9200/test/_analyze?analyzer=custom_raw_analyzer' -d "This Is A Test"

结果:
{
"tokens": [
{
"token": "This Is A Test",
"start_offset": 0,
"end_offset": 14,
"type": "word",
"position": 1
}
]
}

有人可以解释为什么吗?

最佳答案

我认为您有错字:

"filters" : [ "lowercase" ],

不应在结尾加上“s”:
"filter" : [ "lowercase" ],

关于elasticsearch - 具有小写过滤器的自定义分析器无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27947230/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com