gpt4 book ai didi

elasticsearch - Stempel Polish Analysis插件作为Elasticsearch的插件不起作用

转载 作者:行者123 更新时间:2023-12-03 00:13:17 25 4
gpt4 key购买 nike

下面的示例已在es 2.3和1.7上调用。

首先,我安装了插件:https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-stempel.html#analysis-stempel

接下来,我的步骤是检查正确安装的插件:
屏幕显示结果:

Installed plugins in /home/adam/Desktop/elasticsearch-2.3.0/plugins:
- analysis-stempel
- marvel-agent
- license

接下来,我为博客添加了映射:
curl -XPUT localhost:9200/my_index -d '{ 
"mappings": {
"blog": {
"properties": {
"title": {
"type": "string",
"fields": {
"polish": {
"type": "string",
"analyzer": "polish"
}
}
}
}
}
}
}
'

然后我添加了文档:
curl -XPUT localhost:9200/my_index/blog/1 -d
'{ "title": "Bardzo kocham zółwie"}'

当我使用时:
curl -XGET localhost:9200/_search -d
'{
"query": {
"multi_match": {
"type": "most_fields",
"query": "zółwie",
"fields": [ "title", "title.polish" ]
}
}
}
'

Elasticsearch返回正确的结果,但如果我输入:
curl -XGET localhost:9200/_search -d
'{
"query": {
"multi_match": {
"type": "most_fields",
"query": "zolwie",
"fields": [ "title", "title.polish" ]
}
}
}'

Elasticsearch一无所获。

问题在于波兰语特殊字符。

最佳答案

第二个查询需要的是 asciifolding token filter。我建议使用以下映射,以涵盖更多用例:

{
"settings": {
"analysis": {
"analyzer": {
"folding": {
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
"mappings": {
"blog": {
"properties": {
"title": {
"type": "string",
"fields": {
"folding": {
"type": "string",
"analyzer": "folding"
},
"polish": {
"type": "string",
"analyzer": "polish"
}
}
}
}
}
}
}

而这个查询:
{
"query": {
"multi_match": {
"type": "most_fields",
"query": "zolwie",
"fields": [
"title.*"
]
}
}
}

关于elasticsearch - Stempel Polish Analysis插件作为Elasticsearch的插件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38907249/

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