Skip to content

Instantly share code, notes, and snippets.

@cbismuth
Last active October 15, 2018 07:33
Embed
What would you like to do?
cURL recreation script to reproduce Elaticsearch issue #27178
#!/usr/bin/env bash
# elasticsearch-issue-27178.sh
# cURL recreation script to reproduce Elaticsearch issue #27178
# https://github.com/elastic/elasticsearch/issues/27178
NL1="\n"
NL2="${NL1}${NL1}"
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
info () {
now=$(date +"%m-%d-%y %T")
printf "[${now}] ${GREEN}$1${NL1}${NC}"
}
error () {
now=$(date +"%m-%d-%y %T")
printf "[${now}] ${RED}$1${NL1}${NC}"
}
linebreak () {
printf "${NL1}"
}
newline () {
printf "${NL2}"
}
enter() {
read -p "Enable your breakpoints and press [ENTER] to continue"
}
ES_CLUSTER="http://localhost:9200"
info "Delete [index1] index"
curl -XDELETE "${ES_CLUSTER}/index1"
newline
info "Create [index1] index"
curl -XPUT "${ES_CLUSTER}/index1" -H "Content-Type: application/json" --data '{
"settings": {
"index.routing.allocation.require.dne": "dne"
}
}'
newline
info "Get [index1] stats"
curl -XGET "${ES_CLUSTER}/index1/_stats"
newline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment