Skip to content

Instantly share code, notes, and snippets.

@djptek
Created November 13, 2018 08:12
Show Gist options
  • Select an option

  • Save djptek/24e13c246f921cb88b460e54c4fc8d11 to your computer and use it in GitHub Desktop.

Select an option

Save djptek/24e13c246f921cb88b460e54c4fc8d11 to your computer and use it in GitHub Desktop.
Template to set number of shards to 1
# start with a clean install
DELETE test_index
DELETE _template/my_global_template
#create an index
PUT test_index
GET test_index/_settings
# if ES < 7.0 this will have 5 primary shards
# remove the index
DELETE test_index
# add a global template
PUT _template/my_global_template
{
"index_patterns": ["*"],
"settings" : {
"number_of_shards" : 1
},
"order" : 1
}
#re-create the index
PUT test_index
GET test_index/_settings
# new index will have 1 primary shard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment