一、下面展示的是ES 6.X 一般的mapping 文件 (索引数据结构文件)的格式;
/**
* 1. 本地开发环境
* http://127.0.0.1:9400/_template/world.famous_portrait_tpl/
**/
{
"index_patterns": [
"world.famous_portrait" //索引名称
],
"version": 50001,
"settings": {
"index.refresh_interval": "5s", //刷新频率,每5s刷新1次
"index.number_of_replicas": "0", //副本数量0
"index.number_of_shards": "1", //分片数量 1
"max_result_window": 10000000,
"index": {
"analysis": {
"filter": {
"kms_synonym": {
"type": "synonym",
"synonyms_path": "kms_syn.txt" //同义词词库文件(过滤器)
}
},
"analyzer": {
"kms_ik_smart": {
"type": "custom",
"use_smart": "true",
"tokenizer": "ik_smart", //分词器-智能分词
"filter": [
"kms_synonym"
]
},
"kms_ik_max_word": {
"type": "custom",
"use_smart": "false",
"tokenizer": "ik_max_word",//分词器-最大分词
"filter": [
"kms_synonym"
]
},
"douhao": {
"type": "pattern",
"pattern": "," //逗号分词器
}
}
}
}
},
"mappings": //数据接口映射字段,都在mappings里
{
"famous_portrait": //索引类型