# NOT RUN {
body <- '{
"template": "te*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"type1": {
"_source": {
"enabled": false
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z YYYY"
}
}
}
}
}'
index_template_put("template_1", body = body)
# get templates
index_template_get()
index_template_get("template_1")
index_template_get(c("template_1", "template_2"))
index_template_get("template_*")
## filter path
index_template_get("template_1", filter_path = "*.template")
# template exists
index_template_exists("template_1")
index_template_exists("foobar")
# delete a template
index_template_delete("template_1")
index_template_exists("template_1")
# }
Run the code above in your browser using DataLab