📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Elasticsearch Indices and Documents

Indices and Documents

5 min read Quiz at the end
Create indices, index documents with or without IDs, retrieve, and delete via the REST API.

Indices and Documents

# Create an index with settings
PUT /products
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1
  }
}

# Index a document (auto-generates ID)
POST /products/_doc
{ "name": "Widget", "price": 9.99, "stock": 100 }

# Index with specific ID
PUT /products/_doc/1
{ "name": "Widget", "price": 9.99, "stock": 100 }

# Get a document
GET /products/_doc/1

# Delete
DELETE /products/_doc/1
DELETE /products              # delete entire index

# List indices
GET /_cat/indices?v
Topic Quiz · 1 questions

Test your understanding before moving on

1. What is an Elasticsearch index equivalent to in a relational database?
💡 An ES index is analogous to a database table — it holds documents of a similar type.