如何在 ElasticSearch char_filter 中使用多值映射?
How to use multiple values mapping in ElasticSearch char_filter?
我想使用 ElasticSearch char_filter 并将一些希腊字符映射到英文字符。问题是这不是一对一的情况。我想将一些希腊字母与一个以上的英文匹配。例如,我希望将“α”翻译成"a",但我希望将“β”翻译成"b"或"v"。有没有办法用映射来做到这一点?我是否必须使用应该替换的模式以及如何定义两个字符的模式?我现在的设置是这样的:
{
"test": {
"settings": {
"index": {
"creation_date": "1477060982825",
"analysis": {
"filter": {
"myGreekLowerCaseFilter": {
"type": "lowercase",
"language": "greek"
},
"ngrams_filter": {
"type": "ngram",
"min_gram": "3",
"max_gram": "8"
}
},
"analyzer": {
"my_analyzer": {
"filter": [
"lowercase",
"myGreekLowerCaseFilter",
"ngrams_filter"
],
"char_filter": [
"my_mapping"
],
"type": "custom",
"tokenizer": "standard"
}
},
"char_filter": {
"my_mapping": {
"type": "mapping",
"mappings": [
"α => a",
"β => b",
"γ => g",
"δ => d",
"ε => e",
"ζ => z",
"η => h",
"θ => th",
"ι => i",
"κ => k",
"λ => l",
"μ => m",
"ν => n",
"ξ => ks",
"ο => o",
"π => p",
"ρ => r",
"σ => s",
"τ => t",
"υ => y",
"φ => f",
"χ => x",
"ψ => ps",
"ω => w",
"αι => ai",
"ου => ou",
"ει => ei",
"οι => oi",
"αυ => au",
"ευ => eu",
"μπ => mp",
"γκ => gk",
"ντ => nt",
"γγ => gg"
]
}
}
},
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "edpdWk14TRuBpNAWmVNOiA",
"version": {
"created": "2040099"
}
}
}
}
}
char_filter 无法做到这一点。
我想使用 ElasticSearch char_filter 并将一些希腊字符映射到英文字符。问题是这不是一对一的情况。我想将一些希腊字母与一个以上的英文匹配。例如,我希望将“α”翻译成"a",但我希望将“β”翻译成"b"或"v"。有没有办法用映射来做到这一点?我是否必须使用应该替换的模式以及如何定义两个字符的模式?我现在的设置是这样的:
{
"test": {
"settings": {
"index": {
"creation_date": "1477060982825",
"analysis": {
"filter": {
"myGreekLowerCaseFilter": {
"type": "lowercase",
"language": "greek"
},
"ngrams_filter": {
"type": "ngram",
"min_gram": "3",
"max_gram": "8"
}
},
"analyzer": {
"my_analyzer": {
"filter": [
"lowercase",
"myGreekLowerCaseFilter",
"ngrams_filter"
],
"char_filter": [
"my_mapping"
],
"type": "custom",
"tokenizer": "standard"
}
},
"char_filter": {
"my_mapping": {
"type": "mapping",
"mappings": [
"α => a",
"β => b",
"γ => g",
"δ => d",
"ε => e",
"ζ => z",
"η => h",
"θ => th",
"ι => i",
"κ => k",
"λ => l",
"μ => m",
"ν => n",
"ξ => ks",
"ο => o",
"π => p",
"ρ => r",
"σ => s",
"τ => t",
"υ => y",
"φ => f",
"χ => x",
"ψ => ps",
"ω => w",
"αι => ai",
"ου => ou",
"ει => ei",
"οι => oi",
"αυ => au",
"ευ => eu",
"μπ => mp",
"γκ => gk",
"ντ => nt",
"γγ => gg"
]
}
}
},
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "edpdWk14TRuBpNAWmVNOiA",
"version": {
"created": "2040099"
}
}
}
}
}
char_filter 无法做到这一点。