Created
November 12, 2012 13:11
-
-
Save karussell/4059320 to your computer and use it in GitHub Desktop.
A script for the rolling index plugin. To make it easier to be called from cron
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
| # install the roll plugin for every server | |
| # https://github.com/karussell/elasticsearch-rollindex/ | |
| # call this script ala roll.sh <indexPrefix> <type> <numberOfRemainingIndices> | |
| indexprefix=$1 | |
| type=$2 | |
| roll=$3 | |
| SRC= | |
| host=localhost:9200 | |
| # grab the mapping for 'type' from somewhere | |
| MAP_PATH=$SRC"path/to/$type.json" | |
| mappings=$(cat $MAP_PATH) | |
| echo "" | |
| echo `date` | |
| content='{ | |
| "settings" : { | |
| "number_of_shards" : 3, | |
| "number_of_replicas": 1 | |
| }, | |
| "mappings" : '$mappings' | |
| }' | |
| echo $content | |
| curl -XPUT "$host/_rollindex?indexPrefix=$indexprefix&searchIndices=$roll&rollIndices=$roll" -d "$content" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment