我有一个带有char过滤器的自定义分析器:
"char_filter": {
"hash_repl": {
"pattern": "(^[^\\#@].+)",
"type": "pattern_replace",
"preserve_original": "false",
"replacement": "$1 #$1 @$1"
}
}
当我发送测试分析器的POST请求时,我等待的行为如下:
a => a #a @a
#a => #a
@a => @a
问题在于弹性不能呈现" @"回答中的符号,通常我得到
a => a #a a
#a => #a
@a => a
答案 0 :(得分:0)
嗯,解决方案很简单。我的自定义分析器还包含几个char过滤器和令牌过滤器。通过添加自定义映射解决了这个问题:
"char_filter": {
"custom": {
"type": "mapping",
"mappings": [
"#=>|#"
]
}
},
"filter": {
"custom": {
"type": "word_delimiter",
"type_table": [
"# => ALPHA",
"@ => ALPHA"
],
"split_on_numerics": "false"
}
}