Skip to content

Instantly share code, notes, and snippets.

@rodesousa
Last active May 27, 2016 08:27
Show Gist options
  • Select an option

  • Save rodesousa/d07504222b0dd52ebed2 to your computer and use it in GitHub Desktop.

Select an option

Save rodesousa/d07504222b0dd52ebed2 to your computer and use it in GitHub Desktop.
Command ES !

Le changement de la réplication des shards existants a été changé de 1 à 0 via la commande

curl -XPUT "http://localhost:9200/*/_settings" -d '{ "index" : {"number_of_replicas": 0 } }'

status

curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'

info of all index

curl -XGET http://localhost:9200/_cat/shards

Forcer la realocation

for shard in $(curl -XGET http://localhost:9200/_cat/shards | grep UNASSIGNED | awk '{print $2}'); do
    curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "NOM DE INDEX", 
                  "shard" : $shard, 
                  "node" : "NOM D'UN DES NODES DU CLUSTER", 
                  "allow_primary" : true
              }
            }
        ]
    }'
    sleep 5
done

delete index

curl -XDELETE 'http://localhost:9200/twitter/'

Recherche index

curl -XGET 'http://localhost:9200/INDEX/_search?q=CHAMPS:'

pour es 2.X

network:
  host: 0.0.0.0

analyzer un pattern

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html

curl -XGET http://localhost:9200/inde/_xanalyze -d '{"text": "manageur"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment