Elasticsearch & OpenSearch REST API
Index management, boolean search queries, match aggregations, cluster health, and mapping configurations.
Elasticsearch & OpenSearch REST API Interactive Command Directory
Browse, search, and copy battle-tested commands & syntax recipes (16 Total Commands).
Inspect cluster health status (green, yellow, red) and unassigned shard counts.
List all indices with doc counts, storage sizes, and health status sorted by size.
Create an index with explicit text and keyword field type mappings.
Execute structured boolean query combining full-text relevance with exact filter caching.
Compute term buckets and metric averages without returning raw documents.
Index or replace a single JSON document by explicit ID.
Dynamically adjust replica count for high availability and read throughput.
Inspect cluster node JVM heap memory utilization, garbage collection pauses, and operating system CPU load.
Execute background server-side reindexing to apply updated field mappings or token analyzers without downtime.
Atomically switch index alias pointer from legacy index to newly built index without dropped queries.
Search across multiple text fields with 3x relevance boost weighting on title matches.
Stream high-throughput NDJSON document batches to maximize cluster write throughput.
Inspect tokenizer splitting, lowercase filtering, and stemming outputs for given text strings.
List shard allocation, replica status, and primary node placement to troubleshoot unassigned shards.
Execute search query returning HTML tagged fragments matching query tokens for frontend search previews.
Force merge Lucene segment files on read-only indices to reclaim deleted document space and accelerate search.
Companion Developer Tools & Playgrounds
Accelerate command execution and syntax debugging with HelloAIHub suite of interactive tools.
In-Browser Code Runner
Test and benchmark syntax scripts in Node.js, Python, TypeScript, and Go with zero local setup.
Regex Live Tester & Explainer
Debug regular expressions, lookarounds, capture groups, and substitution patterns with live AST explanations.
Dockerfile Generator
Generate multi-stage, rootless, production-hardened Dockerfiles with caching and alpine bases.
System Design Sizing Calculator
Compute real-time QPS, storage bandwidth, cache memory ratios, and replica math for distributed architectures.
Elasticsearch & OpenSearch REST API: Command Groups & Quick Index
16 indexed entries across 16 sectionsHighlighted Flags & Syntax Examples in Elasticsearch & OpenSearch REST API
Inspect cluster health status (green, yellow, red) and unassigned shard counts.
List all indices with doc counts, storage sizes, and health status sorted by size.
Create an index with explicit text and keyword field type mappings.
Execute structured boolean query combining full-text relevance with exact filter caching.
Frequently Asked Questions
Expert recommendations, common traps, and production best practices for Elasticsearch & OpenSearch REST API.
What is the difference between text and keyword data types in Elasticsearch?
text fields undergo full-text analysis (tokenization, lowercasing, stemming) and are optimized for relevance matching. keyword fields are indexed verbatim without tokenization, making them ideal for exact filtering, sorting, and aggregations.
Why should queries in the bool filter clause be preferred over must when scoring is not needed?
filter clauses do not compute relevance scores (_score), allowing Elasticsearch to automatically cache filter bitsets in memory for lightning-fast repeated queries.
What causes unassigned shards in Elasticsearch and how do you resolve cluster yellow/red state?
A 'yellow' cluster means all primary shards are active but some replica shards cannot be assigned (often due to single-node clusters where replicas cannot live on the same host). A 'red' status indicates one or more primary shards are missing. Query 'GET /_cluster/allocation/explain' to inspect the exact failure reason (e.g. disk watermarks, node disconnections).
What is an inverted index and how does BM25 scoring calculate search relevance?
An inverted index maps every distinct tokenized word to the list of document IDs containing it. Okapi BM25 scores documents by calculating Term Frequency (TF, how often the word appears in the document with non-linear saturation), Inverse Document Frequency (IDF, penalizing common terms across the index), and document length normalization.
How does heap memory allocation (50% rule, 32GB compressed OOPs threshold) affect Elasticsearch performance?
Set JVM heap to at most 50% of available physical RAM (leaving the remaining 50% for OS Lucene filesystem page cache) and never exceed ~31GB. Staying below 31GB allows the JVM to use 32-bit Compressed Ordinary Object Pointers (Compressed OOPs), doubling effective memory addressable per pointer.
What is the difference between routing keys and default Murmur3 document sharding?
By default, Elasticsearch routes documents across shards using 'hash(_id) % number_of_shards', requiring search queries to fan out across all shards. By setting a custom routing key (e.g. 'routing=tenant_id'), all documents for that tenant reside on a single shard, allowing queries with that routing key to target a single shard directly.
Cross-Hub Skill Acceleration
Combine command lookups with active coding interviews and complete career paths.
Need More Cheat Sheets?
Explore developer cheat sheets and syntax guides on HelloAIHub.