elasticsearch - 搜索无论越南语字符还是英语字符

标签 elasticsearch

我要搜索结果,而不管是否标记。

例如:我想找到单词“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/

相关文章:

elasticsearch - 搜索等于,包含,全文,小于,大于弹性

performance - 提高Elasticsearch副本创建性能

elasticsearch - Elasticsearch:匹配嵌套对象的数组

lucene - ElasticSearch分数的分母是多少?

Elasticsearch 大小参数不起作用

php - Elasticsearch ~2.0 php - 无法建立连接 - 数组到字符串转换错误

elasticsearch - 弹性查询仅接受4个字符

elasticsearch - 什么是ElasticProperty-Nest 5.5.0版本中的OmitNorms等效项

elasticsearch - 脚本参数不支持 : START_ARRAY in ElasticSearch v7. 类型的值 3 更新脚本

elasticsearch - ANDing Elasticsearch 的搜索关键字