ElasticSearch ElasticSearch Core Concepts & Architecture 2 — Questions and Answers
Question 1: What does 'inverted index' mean in Elasticsearch?
- An index stored in reverse alphabetical order
- A data structure mapping terms to documents containing them (Correct answer)
- An index that has been deleted and restored
- A secondary index on a nested field
Correct answer: A data structure mapping terms to documents containing them
An inverted index maps each unique term to the list of documents in which it appears, enabling fast full-text search.
Question 2: What is the default number of primary shards when creating an index in Elasticsearch 7.x and later?
- 5
- 3
- 1 (Correct answer)
- 10
Correct answer: 1
Starting from Elasticsearch 7.0, the default number of primary shards per index was changed from 5 to 1.
Question 3: What is a 'mapping' in Elasticsearch?
- A visual diagram of cluster nodes
- The schema definition for documents in an index (Correct answer)
- A routing algorithm for shards
- A type of search query
Correct answer: The schema definition for documents in an index
A mapping defines how documents and their fields are stored and indexed, similar to a schema in a relational database.
Question 4: What does the 'near real-time' (NRT) property of Elasticsearch mean?
- Data is available for search within about 1 second after indexing (Correct answer)
- Elasticsearch processes data in exactly real time
- Queries are answered in under 1 millisecond
- Replicas are always in sync with primary shards
Correct answer: Data is available for search within about 1 second after indexing
Near real-time means there is a slight latency (usually around 1 second) between indexing a document and it becoming searchable.
Question 5: What is the purpose of the Elasticsearch '_id' field?
- It stores the document's creation timestamp
- It uniquely identifies each document within an index (Correct answer)
- It defines the routing shard for a document
- It specifies the document's data type
Correct answer: It uniquely identifies each document within an index
The '_id' field is a unique identifier for each document within an index and is used to retrieve, update, or delete specific documents.
Question 6: What does 'dynamic mapping' mean in Elasticsearch?
- Elasticsearch automatically detects and maps new fields as documents are indexed (Correct answer)
- Mappings change based on query type
- A mapping that only applies during indexing
- Routing rules that change dynamically based on load
Correct answer: Elasticsearch automatically detects and maps new fields as documents are indexed
Dynamic mapping allows Elasticsearch to automatically detect and add new fields to a mapping when new documents containing unknown fields are indexed.
What does 'inverted index' mean in Elasticsearch?