What are the _id and _source fields in Elasticsearch?

Answer

The _id field is the unique identifier of a document within its index. You can supply it explicitly (PUT /index/_doc/my-id) or let Elasticsearch auto-generate a random Base64-encoded UUID. The _id is used to retrieve, update, or delete a specific document. The _source field stores the original JSON document as-is at index time. When you retrieve a document with a GET request or a search query, _source contains the original JSON you indexed. You can disable _source to save disk space, but this prevents update operations and reindexing — it is almost never worth disabling in practice.