最近更新时间:2021-03-03 16:10:31
推荐索引模板保存在文件template.json中,内容如下:
{
"order": 0,
"template": "*",
"settings": {
"index": {
"max_result_window": "65536",
"routing": {
"allocation": {
"require": {
"box_type": "hot"
}
}
},
"search": {
"slowlog": {
"threshold": {
"query": {
"warn": "10s",
"info": "5s"
}
}
}
},
"refresh_interval": "60s",
"unassigned": {
"node_left": {
"delayed_timeout": "5m"
}
},
"indexing": {
"slowlog": {
"threshold": {
"index": {
"warn": "10s",
"info": "5s"
}
}
}
},
"number_of_shards": "5",
"translog": {
"flush_threshold_size": "5g",
"sync_interval": "60s",
"durability": "async"
},
"number_of_replicas": "1"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [{
"all_tpl": {
"mapping": {
"ignore_above": 1024,
"index": "not_analyzed",
"type": "{dynamic_type}",
"doc_values": true
},
"match": "*"
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
],
"_all": {
"enabled": false
}
}
},
"aliases": {}
}
模板生效命令:
curl -H "Content-Type: application/json" -XPUT
"es_ip:es_port/_template/.default" -d @template.json
纯净模式