🔍 Elasticsearch
Beginner
How do you perform CRUD operations in Elasticsearch via the REST API?
Answer
Elasticsearch exposes a REST API for all CRUD operations. Create/Index: POST /index/_doc (auto-generates an ID) or PUT /index/_doc/1 (explicit ID). Read: GET /index/_doc/1 retrieves a document by ID. Update: POST /index/_update/1 with a doc or script body performs a partial update. Delete: DELETE /index/_doc/1 removes a document. All responses are JSON and include metadata fields like _index, _id, _version, and result (created/updated/deleted).