Skip to content

Instantly share code, notes, and snippets.

@rawkode
Last active January 28, 2018 15:36
Show Gist options
  • Select an option

  • Save rawkode/91309f57e35d8a3fb6bd9eb864206335 to your computer and use it in GitHub Desktop.

Select an option

Save rawkode/91309f57e35d8a3fb6bd9eb864206335 to your computer and use it in GitHub Desktop.
Create Elasticsearch Schema
#!/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
#!/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