Elastic Search

voir l'état du cluster :

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

Vu detaillé :

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

lister les shards :

curl -XGET 'http://localhost:9200/_cat/shards?v'

Lister les shards non assignés et la raison :

curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED

Cluster Allocution Explain :

curl -XGET localhost:9200/_cluster/allocation/explain?pretty

Forcer les réplicats à zéro :

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

Voir la configuration ES :

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

Procédures de restart d'un noeud ES :

curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "none" }}'

curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "all" }}'

Passer par un module Python pour l'affichage des JSONS :

curl -XGET 'http://localhost:9200/_nodes' | python -m json.tool

Liste les plugins installés :

    cd /usr/share/elasticsearch
    ./bin/plugin --list

Vérifier le mapping (typage des données)

http_proxy= curl -s 'http://localhost:9200/<index_name>/_mapping?pretty=true' | less

Voir la version

curl -XGET 'localhost:9200'

Voir la taille de tous les index

curl -XGET "http://localhost:9200/_cat/shards?v" | awk -F " " '{print $1, $6}' | sort

Fermer un indice

curl -XPOST 'http://localhost:9200/INDICE/_close'

Ouvrir un indice

curl -XPOST 'http://localhost:9200/openvoice/_open'

Lister les repositories

curl -s 0:9200/_snapshot?pretty

Lister les snapshots

curl -XGET 'http://localhost:9200/_snapshot/REPO/_all/?pretty=true'

Lister les tâches en cours

curl -XGET 'http://localhost:9200/_cluster/pending_tasks?pretty'

Consulter la configuration d'un index

http_proxy= curl 'http://localhost:9200/<index_name>/_settings?pretty=true'

Etat de chaque nœud du cluster

curl -XGET 'http://localhost:9200/_cat/nodes?v'

Recovery status

curl -XGET 'localhost:9200/_cat/recovery?v'
Last updated on 18th Apr 2023