Last active
January 28, 2018 15:36
-
-
Save rawkode/91309f57e35d8a3fb6bd9eb864206335 to your computer and use it in GitHub Desktop.
Create Elasticsearch Schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| kubectl -n $1 describe configmap/$2 | |
| if [[ $? -ne 0 ]]; | |
| then | |
| DATE=$(date +%Y-%m-%d_%H%M) | |
| kubectl -n $1 create configmap $2 --from-literal=consumer_group=${3}-${DATE} | |
| fi | |
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # $1 - Elasticsearch URI | |
| # $2 - Elasticsearch Index | |
| # $3 - Schema Mappping File | |
| curl --fail -s -X GET -H "Content-Type: application/json" ${1}/${2} | |
| if [[ $? -ne 0 ]]; | |
| then | |
| curl -s -X PUT -H "Content-Type: application/json" -d @${3} ${1}/${2} | |
| echo "Elasticsearch index created" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment