Elasticsearch medium
Why is it common practice to use the `_bulk` API instead of multiple single `index` requests for data ingestion?
- A The Bulk API uses a faster binary socket protocol instead of HTTP.
- B Batch Processing: It reduces the network round-trip overhead and allows the cluster to combine multiple operations into a single Lucene disk commit, significantly increasing indexing throughput (WPS).
- C The single index API is limited to only 4KB of data per request.
- D Bulk indexing is the only way to avoid 'Version Conflicts'.
Answer: B. Batch Processing: It reduces the network round-trip overhead and allows the cluster to combine multiple operations into a single Lucene disk commit, significantly increasing indexing throughput (WPS).
Every HTTP request involves a handshake, headers, and parsing. Replaying this 1,000 times for 1,000 docs is inefficient. `_bulk` allows you to send a single large payload, letting Elasticsearch distribute the work across shards in parallel with far less noise.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What are the two primary reasons for configuring one or more 'Replica Shards' for an index?
- When a String field is mapped as `text`, what process is performed to enable full-text search capability?
- What is the primary benefit of splitting an Elasticsearch index into multiple 'Primary Shards'?
- Every document stored in an Elasticsearch index is uniquely tracked by which mandatory metadata field?
- Elasticsearch search results include a metadata field called `_score`. What does this value primarily indicate?
- What is the primary architectural purpose of Elasticsearch in a modern software stack?