ElasticSearch Quality Control & Assurance 2 — Questions and Answers
Question 1: Which Elasticsearch API lets you simulate how a document would be analyzed without indexing it?
- _validate/query
- _analyze (Correct answer)
- _explain
- _profile
Correct answer: _analyze
The _analyze API applies a specified analyzer (or field's analyzer) to text and returns the resulting tokens, allowing you to verify analysis behavior without indexing.
Question 2: What does the `_validate/query` API return when passed `explain=true`?
- Token-level analysis of query terms
- A human-readable explanation of why the query is valid or invalid (Correct answer)
- The estimated document count matching the query
- The mapping types relevant to the query
Correct answer: A human-readable explanation of why the query is valid or invalid
With `explain=true`, `_validate/query` returns a textual description of the parsed query structure and any validation errors, without executing the search.
Question 3: Which shard allocation setting should you verify to ensure primary and replica shards are never on the same node?
- index.routing.allocation.require
- cluster.routing.allocation.same_shard.host (Correct answer)
- index.routing.allocation.exclude
- index.auto_expand_replicas
Correct answer: cluster.routing.allocation.same_shard.host
`cluster.routing.allocation.same_shard.host` prevents allocating primary and replica of the same shard to nodes sharing the same host, protecting data redundancy.
Question 4: How do you confirm that an index template was applied correctly to a newly created index?
- GET /_cat/templates
- GET /<index>/_settings and GET /<index>/_mapping (Correct answer)
- POST /<index>/_refresh
- GET /_cluster/stats
Correct answer: GET /<index>/_settings and GET /<index>/_mapping
Checking `_settings` and `_mapping` on the new index shows whether the template's settings (shards, replicas, analyzers) and mappings were applied as expected.
Question 5: What Elasticsearch feature can automatically enforce that documents in an index match a required structure?
- Dynamic mapping with `dynamic: true`
- Strict mapping with `dynamic: strict` (Correct answer)
- Index lifecycle policy
- Ingest pipeline with set processor
Correct answer: Strict mapping with `dynamic: strict`
Setting `dynamic: strict` causes Elasticsearch to reject any document containing a field not already defined in the mapping, enforcing schema compliance.
Question 6: Which metric in the nodes stats API indicates that the JVM garbage collector is impacting query performance?
- jvm.mem.heap_used_percent
- jvm.gc.collectors.old.collection_time_in_millis (Correct answer)
- os.cpu.percent
- thread_pool.search.rejected
Correct answer: jvm.gc.collectors.old.collection_time_in_millis
High `jvm.gc.collectors.old.collection_time_in_millis` indicates frequent or long old-generation GC pauses, which stall query processing and degrade performance.
Question 7: What is the purpose of the `index.blocks.read_only_allow_delete` block that Elasticsearch sets automatically?
- Prevent accidental deletions during a reindex
- Protect the index when the node is low on disk space (Correct answer)
- Lock the index during a snapshot
- Enforce write-once semantics for audit logs
Correct answer: Protect the index when the node is low on disk space
Elasticsearch automatically sets `index.blocks.read_only_allow_delete` when disk usage exceeds the flood-stage watermark, allowing only deletes to free space.
Which Elasticsearch API lets you simulate how a document would be analyzed without indexing it?