You perform CRUD on Elasticsearch documents with the document APIs. Each operation is one HTTP request to a path made of the index name and the document ID.
To create a document, or replace it if the ID exists, send PUT with the JSON body. This is called indexing a document.
PUT /users/_doc/1
{
"name": "John Doe",
"email": "john@example.com",
"age": 30
}
To read it, send GET to the same path.
GET /users/_doc/1
To change only some fields, use the update API. It merges the partial doc into the stored document.
POST /users/_update/1
{
"doc": {
"age": 31
}
}
To delete it, send DELETE to the same path.
DELETE /users/_doc/1
For many documents, the bulk API sends many operations in one request. The body is newline-delimited JSON, with an action line before each document. Bulk requests are much faster than one request per document, which matters for large loads.
POST /_bulk
{"index": {"_index": "users", "_id": "1"}}
{"name": "Alice", "age": 25}
{"index": {"_index": "users", "_id": "2"}}
{"name": "Bob", "age": 30}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓