Elastic search helper.
On AWS the first step is to run gen3 es port-forward
that forwards
a connection to the aws-es-proxy
pod, and sets up the ESHOST
environment variable, so can curl $ESHOST
(re)create an alias for the given index if alias-name is given - otherwise just lists the aliases associated with the given index
delete and index or document
dump the contents of an ES index (ex: arranger-projects)
list the ES indices that can be garbage collected
- select indices not referenced by an alias ignoring time_ aliases
- select indices that look like an ETL index: NAME_NUMBER
- group the remaining NAME_NUMBER indices by NAME, and remove the largest NUMBER index from each group
- return the remaining indices
list the elastic search indices
fetch the type-mapping for the given index
forward the es-proxy to localhost, and export ESHOST
create a new ES index with the given type mappings
Sample mapping file:
{
"mappings" : {
"_doc" : {
"properties" : {
"array" : {
"type" : "keyword"
},
"timestamp" : {
"type" : "date"
}
}
}
}
}
Also see the jenkins setup scripts in the gen3-qa repo.
Hit the _cluster/health
endpoint.