3-11的自定义分词不生效
来源:3-11 -自定义分词

rick_and_
2021-02-27
跟着视频敲的, 不生效
PUT test_index_2
{
"settings": {
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"char_filter": [
"emoticons"
],
"tokenizer": "punctuation",
"filter": [
"lowercase",
"english_stop"
]
}
},
"tokenizer": {
"punctuation": {
"type": "pattern",
"pattern": "[.,?!]"
}
},
"char_filter": {
"emoticons": {
"type": "mapping",
"mappings": [
":)=>happy",
":(=>cry"
]
}
},
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
}
}
}
}
}
2回答
-
rockybean
2021-02-28
这个是因为你 :) 配置和测试不一致,前者英文,后者中文,参见下面
GET test_index_2/_analyze
{
"analyzer": "my_custom_analyzer",
"text": "hi, he drink milk! :)"
}
PUT test_index_2
{
"settings": {
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"char_filter": [
"emoticons"
],
"tokenizer": "punctuation",
"filter": [
"lowercase",
"english_stop"
]
}
},
"tokenizer": {
"punctuation": {
"type": "pattern",
"pattern": "[.,?!]"
}
},
"char_filter": {
"emoticons": {
"type": "mapping",
"mappings": [
":)=>happy",
":(=>cry"
]
}
},
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
}
}
}
}
}
00 -
rockybean
2021-02-27
es 的版本是多少?
报错是什么?
012021-02-27
相似问题