索引模板管理

查看索引模板

curl 192.168.1.27:9200/_index_template

创建索引模板

curl -X PUT 192.168.1.27:9200/_index_template/<index-template-name> \
  -H "Content-Type: application/json" \
  -d '{
    "template": {
        "aliases": {
            "K8s": {},
            "SRE": {}
        },
        "settings": {
            "index": {
                "number_of_shards": 3,
                "number_of_replicas": 1
            }
        },
        "mappings": {
            "properties": {
                "ip_addr": {
                    "type": "ip"
                },
                "access_time": {
                    "type": "date"
                },
                "address": {
                    "type": "text"
                },
                "name": {
                    "type": "keyword"
                },
                "age": {
                    "type": "integer"
                }
            }
        }
    },
    
    "index_patterns": [
        "study-*"
    ]
}'

查看索引模板

curl -X DELETE 192.168.1.27:9200/_index_template/<index-template-name>

Last updated