我要搜索结果,而不管是否标记。
例如:我想找到单词“rồngphượng”,但是当我键入“rong”,“rong phuong”,“phuong”,“rồngphuong”,“rongphượng” ...时,我都得到正确的结果。
最佳答案
我认为您需要icu_folding
token 过滤器:
PUT /my_index
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "icu_tokenizer",
"filter": [ "icu_folding", "lowercase" ]
}
}
}
},
"mappings": {
"my_type": {
"properties": {
"text": {
"type": "string",
"analyzer": "my_analyzer"
}
}
}
}
}
然后使用一个简单的
match
查询:GET /my_index/my_type/_search
{
"query": {
"match": {
"text": "phượng"
}
}
}
关于elasticsearch - 搜索无论越南语字符还是英语字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36517490/