【发布时间】:2021-05-07 21:10:40
【问题描述】:
我在这样的记录中有一个字段:
{
....
"test_field": "/xyz/abc-2021abs/drf/2021ABC"
....
}
在pattern_capture 的帮助下,我正在创建一个不忽略正斜杠 (/) 的分析器。
这是我的映射和分析器。
{
"mappings": {
"properties": {
"test_field": {
"type": "text",
"analyzer": "test_field_analyzer",
"fields": {
"exact": {
"type": "keyword"
}
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"test_field_analyzer": {
"tokenizer" : "pattern",
"filter" : [ "test_filter"]
}
},
"filter" : {
"test_filter" : {
"type" : "pattern_capture",
"preserve_original" : true,
"patterns" : ["(\\p{Punct}+\\p{Alnum})"]
}
}
}
}
}
当我检查生成的令牌时,正斜杠 (/) 被忽略,并且模式捕获的工作方式似乎与 pattern_capture 上的示例不同。
请让我知道我哪里做错了。
【问题讨论】: