0
0
Elasticsearchquery~20 mins

Elasticsearch vs relational databases - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Elasticsearch vs Relational Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Elasticsearch Query Result Count
Given the following Elasticsearch query on an index with 100 documents, 30 of which have the field status set to active, what is the total hits count returned by this query?
Elasticsearch
{
  "query": {
    "term": { "status": "active" }
  }
}
A70
B30
C0
D100
Attempts:
2 left
💡 Hint
The term query matches documents where the field exactly matches the given value.
🧠 Conceptual
intermediate
2:00remaining
Data Model Differences
Which statement best describes a key difference between Elasticsearch and relational databases in how they store data?
AElasticsearch stores data as JSON documents optimized for search, while relational databases store data in tables with fixed schemas.
BElasticsearch uses tables and rows like relational databases but adds full-text search capabilities.
CBoth Elasticsearch and relational databases store data as key-value pairs without schemas.
DRelational databases store data as JSON documents, while Elasticsearch uses fixed schemas with tables.
Attempts:
2 left
💡 Hint
Think about how flexible the data format is in each system.
🔧 Debug
advanced
2:00remaining
Why Does This Elasticsearch Query Fail?
Consider this Elasticsearch query that tries to filter documents where age is greater than 30: { "query": { "range": { "age": { "gt": 30 } } } } Which option explains why this query might fail or return no results if age is stored as a text field in Elasticsearch?
ARange queries require numeric fields; if <code>age</code> is text, the query will not work as expected.
BElasticsearch does not support range queries on any field type.
CThe syntax of the range query is incorrect; it should use <code>greater_than</code> instead of <code>gt</code>.
DThe query is missing a <code>filter</code> wrapper around the range clause.
Attempts:
2 left
💡 Hint
Check the data type requirements for range queries in Elasticsearch.
Predict Output
advanced
2:00remaining
Relational Database Join vs Elasticsearch Nested Query
In a relational database, joining two tables returns combined rows. Which Elasticsearch query type best mimics this behavior for nested objects within documents?
ARange query
BTerm query
CMatch all query
DNested query
Attempts:
2 left
💡 Hint
Think about how Elasticsearch handles arrays of objects inside documents.
🚀 Application
expert
2:00remaining
Choosing Between Elasticsearch and Relational Databases
You need to build a system that supports complex transactions, strong data consistency, and structured reporting. Which database type is generally more suitable for this use case?
AElasticsearch, because it is optimized for complex transactions.
BElasticsearch, because it provides fast full-text search and flexible schemas.
CRelational databases, because they support ACID transactions and structured schemas.
DNeither, a NoSQL key-value store is better for transactions.
Attempts:
2 left
💡 Hint
Consider which system guarantees strong consistency and transactional support.