Common Endpoints
Cluster
Cluster Health
Using curl
:
Cluster Nodes
Cluster Indices
Cluster Shards
Index
Create Index
Delete Index
Add Documents
You can specify a document id:
Get Document by _id
Delete Document by _id
Update a document
Actually retrieve old -> Add -> Replace
Update documents using script
Script can also be used. For example, subtract a numeric field by 1
We can also declare params
Do operation upon condition:
ctx.op = 'noop'
ctx.op = 'delete'
Update multiple documents
For example, decrement <field>
by 1 in bulk:
Bulk
Create index + Create document
Update / Delete document
We can also use: POST /<index>/_bulk
Note:
Content-Type
should beapplication/x-ndjson
if using script / curl etc.Each line must end with a newline character
\n
or\r\n
(In text editor, this means the last line should be empty) (Don't type\n
or\r\n
in a text editor!)A failed action will not affect other actions
Can use optimistic concurrency control within the action metadata!
Last updated