sudo useradd -D -s /bin/bash # This makes bash the default useradd shell
useradd app -m
usermod -aG sudo app
This gist assums that you are running a Ruby on Rails project and you are using the elasticsearch-rails gem to operate with your Elasticsearch cluster.
This script is using the Elasticsearch Index Aliases and Reindex API to provide a way for applying zero downtime index mapping changes (adding, deleting or modifying a field).
Let's say that you have an Article
model which by default references an articles
index in Elasticsearch. And lets assume that articles
is an alias to a timestamped index articles_20180101000001
.
Running the script will:
articles_20180101000002