Skip to content

Instantly share code, notes, and snippets.

@shaharmor
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save shaharmor/b51a9297337133efab5f to your computer and use it in GitHub Desktop.

Select an option

Save shaharmor/b51a9297337133efab5f to your computer and use it in GitHub Desktop.

Revisions

  1. shaharmor revised this gist Aug 11, 2015. No changes.
  2. shaharmor revised this gist Aug 11, 2015. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions loop.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    YEAR_START=2015
    YEAR_END=2015
    MONTH_START=1
    MONTH_END=12
    DAY_START=1
    DAY_END=31

    for year in $(seq -f "%04g" $YEAR_START $YEAR_END)
    do
    for month in $(seq -f "%02g" $MONTH_START $MONTH_END)
    do
    for day in $(seq -f "%02g" $DAY_START $DAY_END)
    do
    echo "$year.$month.$day"
    done
    done
    done
  3. shaharmor revised this gist Aug 11, 2015. 5 changed files with 7 additions and 35 deletions.
    1 change: 1 addition & 0 deletions cache.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    curl -XPUT localhost:9200/logstash-YYYY.MM.DD/_settings -d '{ "index.cache.query.enable": true }'
    1 change: 1 addition & 0 deletions optimize.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    curl -XPOST "localhost:9200/logstash-YYYY.MM.DD/_optimize?max_num_segments=1"
    19 changes: 0 additions & 19 deletions reindex-month.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +0,0 @@
    # beofre using this script you must install the reindex module from https://github.com/codelibs/elasticsearch-reindexing
    # using $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-reindexing/1.7.0

    for i in $(seq -f "%02g" 1 31)
    do
    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo -e "\nDeleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo -e "\nReindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo -e "\nDeleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
    done
    16 changes: 0 additions & 16 deletions reindex-single.sh
    Original file line number Diff line number Diff line change
    @@ -1,16 +0,0 @@
    # beofre using this script you must install the reindex module from https://github.com/codelibs/elasticsearch-reindexing
    # using $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-reindexing/1.7.0

    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo -e "\nDeleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo -e "\nReindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo -e "\nDeleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
    5 changes: 5 additions & 0 deletions reindex.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # beofre using this script you must install the reindex module from https://github.com/codelibs/elasticsearch-reindexing
    # using $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-reindexing/1.7.0

    curl -XPOST "localhost:9200/logstash-YYYY.MM.DD/_reindex/logstash-YYYY.MM.DD-old/?wait_for_completion=true"
    curl -XDELETE "localhost:9200/logstash-YYYY.MM.DD/"
  4. shaharmor revised this gist Jul 30, 2015. 2 changed files with 6 additions and 6 deletions.
    6 changes: 3 additions & 3 deletions reindex-month.sh
    Original file line number Diff line number Diff line change
    @@ -6,13 +6,13 @@ do
    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i"
    echo -e "\nDeleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    echo -e "\nReindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i-old"
    echo -e "\nDeleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
    6 changes: 3 additions & 3 deletions reindex-single.sh
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,13 @@
    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i"
    echo -e "\nDeleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    echo -e "\nReindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i-old"
    echo -e "\nDeleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
  5. shaharmor revised this gist Jul 30, 2015. 2 changed files with 6 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions reindex-month.sh
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,8 @@ do
    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
    done
    3 changes: 3 additions & 0 deletions reindex-single.sh
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,7 @@ curl -XDELETE "localhost:9200/logstash-2015.03.$i/"
    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i-old"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i-old/"

    echo "Finished reindexing logstash-2015.03.$i"
  6. shaharmor revised this gist Jul 30, 2015. No changes.
  7. shaharmor revised this gist Jul 30, 2015. No changes.
  8. shaharmor revised this gist Jul 30, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions reindex-month.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # beofre using this script you must install the reindex module from https://github.com/codelibs/elasticsearch-reindexing
    # using $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-reindexing/1.7.0

    for i in $(seq -f "%02g" 1 31)
    do
    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
  9. shaharmor created this gist Jul 30, 2015.
    13 changes: 13 additions & 0 deletions reindex-month.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    for i in $(seq -f "%02g" 1 31)
    do
    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Finished reindexing logstash-2015.03.$i"
    done
    13 changes: 13 additions & 0 deletions reindex-single.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # beofre using this script you must install the reindex module from https://github.com/codelibs/elasticsearch-reindexing
    # using $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-reindexing/1.7.0

    echo "Reindexing logstash-2015.03.$i to logstash-2015.03.$i-old"
    curl -XPOST "localhost:9200/logstash-2015.03.$i/_reindex/logstash-2015.03.$i-old/?wait_for_completion=true"

    echo "Deleting logstash-2015.03.$i"
    curl -XDELETE "localhost:9200/logstash-2015.03.$i/"

    echo "Reindexing logstash-2015.03.$i-old to logstash-2015.03.$i"
    curl -XPOST "localhost:9200/logstash-2015.03.$i-old/_reindex/logstash-2015.03.$i/?wait_for_completion=true"

    echo "Finished reindexing logstash-2015.03.$i"