ELASTIC

Elastic Developer Cheatsheet

Elastic Developer Cheatsheet

Cheatsheet for Elastic Developer

Nathan Obert
Introduction This is a quick cheat sheet from Sematext’s Elastic Developer Cheatsheet Data Manipulation Put/Get/Delete index curl -XPUT localhost:9200/index-name -d '{"settings": { "number_of_shards": 1}}' curl -XGET localhost:9200/index-name?pretty curl -XDELETE localhost:9200/index-name Put/Get/Delete template curl -XPUT localhost:9200/_template/template-name -d '{ "template": "logs*", "mappings": { "foo-type": { "properties": { "foo-field": { "type": "text" } } } }, "settings": { "number_of_shards": 1 } }' curl -XGET localhost:9200/_template/template-name?pretty curl -XDELETE localhost:9200/_template/template-name Bulk API echo '{"index": { "_index": "logs01", "_type": "logs"}} {"title": "this is an error"} {"index": { "_index": "logs02", "_type": "logs"}} {"title": "this is a warning"} {"delete": { "_index": "logs03", "_type": "logs", "_id": "abc123"}} ' > /tmp/bulk curl localhost:9200/_bulk?
Elastic Devops Cheatsheet

Elastic Devops Cheatsheet

Cheatsheet for Elastic Devops

Nathan Obert
Introduction This is a quick cheat sheet from Sematext’s Elastic Devops Cheatsheet DevOps cheatsheet Allocation Allocation awareness Avoids putting two copies of the same shard on nodes with the same attribute (e.g. rack, availability zone). For example: node.attr.availability_zone: us-east1 # in elasticsearch.yml Awareness is enabled at the cluster level: curl -XPUT localhost:9200/_cluster/settings?pretty -d '{ "persistent" : { "cluster.routing.allocation.awareness.attributes" : "availability_zone" } }' Allocation filtering Shards of an index can prefer/avoid nodes with certain attributes.