Thursday, October 15, 2020

ElasticSearch Commands and Support

Curl to GET index data includes header and replicas  with sort by replica.

curl -X GET "http://IP:9200/_cat/indices?h=index,rep&s=rep"

Check the cluster health

curl -X GET "http://IP:9200/_cluster/health?pretty=json"

Turn of cluster settings for wildCard index execution

curl -XPUT "http://IP:9200/_cluster/settings" -H 'Content-Type: application/json' -d'{"persistent":{"action.destructive_requires_name":"false"}}'

curl -XDELETE "http://IP:9200/1.9.2__idx_test__y*"

curl -XPUT "http://IP:9200/_cluster/settings" -H 'Content-Type: application/json' -d'{"persistent":{"action.destructive_requires_name":"true"}}'

Update index replication

curl -X PUT "http://IP:9200/index_name/_settings" -H 'Content-Type: application/json' -d '{"index":{"refresh_interval":"30s","number_of_replicas":1}}'

RED ElasticSearch Cluster (Debug with explain to see the current allocation).

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


Find Red Indices: 
health can be red, green, yellow
curl -XGET 'http://IP:9200/_cat/indices?health=red'

GET Indices and its store size
curl -XGET "http://IP:9200/_cat/indices?format=json&s=store.size:desc" > cat_indices_feb9.json


No comments :

// Below script tag for SyntaxHighLighter