Skip to content

Instantly share code, notes, and snippets.

@zumo64
Last active July 19, 2016 07:46
Show Gist options
  • Save zumo64/f36a4aba2de3e5e2ebaf767d7cee0896 to your computer and use it in GitHub Desktop.
Save zumo64/f36a4aba2de3e5e2ebaf767d7cee0896 to your computer and use it in GitHub Desktop.
templates workshop
# Start
PUT _template/my_data_template1
{
"template": "my_data_*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"_default_": {
"_all": {
"enabled": false
}
}
},
"order": 10
}
PUT _template/my_data_template2
{
"template": "my_data_1*",
"mappings": {
"_default_": {
"_all": {
"enabled": false
},
"dynamic": "strict",
"properties":{
"name":{
"type":"text"
},
"country":{
"type":"text"
},
"age":{
"type":"long"
}
}
}
},
"order": 11
}
PUT /my_data_12/type/1
{
"name":"John",
"country":"Denmark",
"age" : 23
}
GET _cat/indices/my_data*
GET /my_data_12/type/1
PUT /my_data_12/type/2
{
"name":"John",
"country":"Denmark",
"age" : 23,
"role":"master"
}
# Cleanup
DELETE my_data_12
DELETE _template/my_data_template*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment