Elasticsearch Search and analytics engine
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
curl -s $EScurl -s $ES/_cat/indices?v
curl -s $ES/_cluster/health?pretty
curl -X PUT $ES/<index>
curl --json '<json>'
$ES/<index>/_doc
curl -s $ES/<index>/_search?q=<text>
curl -s $ES/<index>/_doc/<id>
curl -X DELETE $ES/<index>
Concepts
Cluster and cat
GET /GET _cluster/health?pretty
GET _cat/indices?v
GET _cat/nodes?v
GET _cat/shards/<index>?v
GET _cat/indices?v&s=store.size:desc
GET _cat/indices?help
GET _cluster/allocation/explain
GET _nodes/stats
GET _tasks?detailed
Indices
PUT <index>
DELETE <index>
GET <index>/_mapping
GET <index>/_settings
PUT <index>/_mapping
PUT <index>/_settings
POST <index>/_refresh
POST <index>/_close
POST _aliasesDocuments
POST <index>/_doc
PUT <index>/_doc/<id>
GET <index>/_doc/<id>
DELETE <index>/_doc/<id>
POST <index>/_update/<id>
GET <index>/_count
GET <index>/_source/<id>
POST <index>/_delete_by_query
POST <index>/_update_by_query
GET _mgetSearch
GET
<index>/_search?q=<field>:<text>
POST <index>/_search
{"match": {"<field>":
"<text>"}}
{"term": {"<field>":
"<value>"}}
{"bool": {"must": [], "filter": [],
"must_not": []}}
{"range": {"<field>": {"gte":
10, "lt": 20}}}
{"exists": {"field":
"<field>"}}
{"match_phrase": {"<field>":
"<text>"}}
"size": 20, "from": 40
"sort": [{"<field>":
"desc"}]
"_source": ["<field>"]
"explain": true
"pit": {...}, "search_after": [...]
POST <index>/_validate/query?explain
Aggregations
"size": 0, "aggs": {"by":
{"terms": {"field":
"<f>"}}}
{"avg": {"field":
"<field>"}}
{"date_histogram": {"field":
"<f>", "calendar_interval":
"day"}}
{"percentiles": {"field":
"<field>"}}
{"cardinality": {"field":
"<field>"}}
Bulk and reindex
POST _bulkPOST _reindexGET _tasks/<task_id>
Recipes
curl -X PUT $ES/books --json '{"mappings": {"properties": {"year": {"type": "integer"}}}}'curl -X POST "$ES/books/_bulk?refresh" \ -H 'Content-Type: application/x-ndjson' --data-binary @books.ndjsoncurl -s "$ES/books/_search?q=title:dune&pretty"
# alias books -> books_v1curl -X PUT $ES/books_v2 --json @mapping.jsoncurl -X POST $ES/_reindex --json \ '{"source": {"index": "books_v1"}, "dest": {"index": "books_v2"}}'curl -X POST $ES/_aliases --json @swap.json
curl -s $ES/books/_search --json '{ "query": {"bool": {"must": {"match": {"title": "dune"}}, "filter": {"range": {"year": {"gte": 1965}}}}}, "aggs": {"genre": {"terms": {"field": "genre"}}}}'
curl -s "$ES/books/_search?size=100" \ | jq -r '.hits.hits[]._id'



