【发布时间】:2017-05-12 13:16:11
【问题描述】:
我有一个要求,我需要使用以下条件执行搜索。
1]不区分大小写的匹配
2]特殊字符匹配
3]部分匹配
我正在使用“ngram过滤器”如下,满足以上所有需求 但是,我将索引一个非常庞大的数据,其中包含“cmets”、“descriptions”等字段,其长度可能长达 150 个单词。 从网络参考我认为使用“ngram”过滤器会导致大量磁盘空间使用。 有没有其他方法可以满足以上要求
{
"template": "*",
"settings": {
"analysis": {
"filter": {
"ngram_filter": {
"type": "ngram",
"min_gram": 1,
"max_gram": 25
}
},
"analyzer": {
"case_insensitive": {
"tokenizer": "whitespace",
"filter": [
"ngram_filter",
"lowercase"
]
},
"search_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": "lowercase"
}
}
}
},
"mappings": {
"incidents": {
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "string",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "case_insensitive",
"search_analyzer": "search_analyzer"
}
}
}
]
}
}
}
谢谢!
【问题讨论】: