Elasticsearch让你的Ik分词器支持特殊符号和驼峰分词
2019-07-15 本文已影响0人
yuerumylove
{
"settings": {
"index.number_of_shards": 3,
"index.max_result_window": 20000000,
"number_of_replicas": 1,
"index.refresh_interval": "60s",
"index.highlight.max_analyzed_offset": "10000",
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "ik_max_word",
"char_filter": [
"camel_case_filter",
"special_character_filter"
]
}
},
"char_filter": {
"camel_case_filter": {
"type": "pattern_replace",
"pattern": "(?<=\\p{Lower})(?=\\p{Upper})",
"replacement": " "
},
"special_character_filter": {
"type": "pattern_replace",
"pattern": "(?:\\p{Punct})",
"replacement" : " "
}
}
}
},
"mappings": {
"record": {
"_all" : { "enabled" : false },
"dynamic": true,
"date_detection": true,
"properties": {
"id": {
"type": "keyword",
"index": true
},
"record" : {
"type": "text",
"index": "true",
"analyzer": "my_analyzer",
"search_analyzer" : "ik_smart",
"fields": {
"exact": {
"type": "keyword"
}
},
"fielddata": true
}
}
}
}
}