我是Elasticsearch集群的索引,我想支持语音匹配。
这是我的要求:
curl -XPUT "http://localhost:9200/propertywebsites/_mapping/doc?pretty" -i -d '
{
"properties" : {
"phoneticbuilding" : {
"type" : "string",
"fields" : {
"phonetic" : {
"type" : "string",
"analyzer" : "dbl_metaphone"
}}}}
}
'
我收到了此错误回复:
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=UTF-8
Content-Length: 116
{
"error" : "MapperParsingException[Analyzer [dbl_metaphone] not found for field [phonetic]]",
"status" : 400
}
任何人都知道为什么dbl_metaphone分析仪无法识别语音字段?
我的弹性搜索版本为elasticsearch-1.7.2
我已经将分析仪作为以下
PUT myIndexName/
{
"settings": {
"analysis": {
"filter": {
"dbl_metaphone": {
"type": "phonetic",
"encoder": "double_metaphone"
}
},
"analyzer": {
"dbl_metaphone": {
"tokenizer": "standard",
"filter": "dbl_metaphone"
}
}
}
}
}
查询此请求
curl -XGET "http://localhost:9200/propertywebsites/_settings?pretty"
我收到以下回复:
{
"propertywebsites" : {
"settings" : {
"index" : {
"creation_date" : "1451838136296",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"version" : {
"created" : "1070299"
},
"uuid" : "KVOuKVgGRBudsSplownrgg",
"analsis" : {
"filter" : {
"dbl_metaphone" : {
"type" : "phonetic",
"encoder" : "double_metaphone"
}
},
"analyzer" : {
"dbl_metaphone" : {
"filter" : "dbl_metaphone",
"tokenizer" : "standard"
}
}
}
}
}
}
}
答案 0 :(得分:1)
“dbl_metaphone”是一个令牌过滤器,而不是分析器。您需要先安装Phonetic Analysis插件,然后使用它创建自定义分析器。在https://www.elastic.co/guide/en/elasticsearch/guide/current/phonetic-matching.html了解更多信息。