Big Data 7 min read

Elasticsearch 7.x: Documents, Indices, and REST API Overview

This article provides a concise tutorial on Elasticsearch 7.x, explaining what documents and indices are, how unique IDs and metadata work, and demonstrating key REST API commands for managing and querying data in a search‑engine context.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Elasticsearch 7.x: Documents, Indices, and REST API Overview

Today we continue the latest basic introduction, summarizing Elasticsearch 7.x documents, indices, and REST API.

1. Document

In Elasticsearch a document is the smallest searchable unit, represented as a JSON object stored in an index. Examples include log entries, movie information, or file metadata.

1.1 Document fields

Each document consists of name/value pairs; field names are the JSON keys and field types can be string, integer, long, etc., supporting nested data.

1.2 Unique ID

Every document has a unique _id which can be user‑defined or auto‑generated. The _id is not indexed for aggregations, scripts or sorting; copy it to a regular field if needed.

PUT my_index/_doc/1
{
  "text": "Document with ID 1"
}
PUT my_index/_doc/2&refresh=true
{
  "text": "Document with ID 2"
}
GET my_index/_search
{
  "query": {
    "terms": {
      "_id": [ "1", "2" ]
    }
  }
}

1.3 Metadata

Metadata fields include _index , _type , _id , _score , _source , and _version . The _type is deprecated since 7.0; only a single type _doc is allowed.

2. Index

An index is a logical container for similar documents, analogous to a database table. As a verb, “to index” means to store a document and build an inverted index.

Example of retrieving index mapping and settings via GET request shows field definitions, shard configuration, and aliases.

GET http://localhost:9200/kibana_sample_data_flights

Aliases allow seamless index migration by keeping a stable name while the underlying index changes.

3. REST API

Elasticsearch provides a RESTful API for all operations. Common index‑related commands include viewing index info, counting documents, searching, and using the _cat APIs for health and statistics.

# View index info
GET kibana_sample_data_ecommerce
# Count documents
GET kibana_sample_data_ecommerce/_count
# Search first 10 docs
POST kibana_sample_data_ecommerce/_search
{}
# List indices
GET /_cat/indices/kibana*?v&s=index

These APIs can be accessed via tools like Postman or Kibana’s Dev Tools.

Big DataElasticsearchREST APIIndexdocument
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.