0
0
Elasticsearchquery~10 mins

Elasticsearch vs relational databases - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an index named 'products' in Elasticsearch.

Elasticsearch
PUT /[1]
Drag options to blanks, or click blank then click option'
Aproducts
Busers
Ccustomers
Dorders
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong index name that does not match the data context.
Using POST instead of PUT to create an index.
2fill in blank
medium

Complete the query to search for documents where the field 'name' matches 'laptop'.

Elasticsearch
{
  "query": {
    "match": {
      "[1]": "laptop"
    }
  }
}
Drag options to blanks, or click blank then click option'
Atitle
Bname
Ccategory
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Searching in the wrong field like 'title' or 'category'.
Using a field that does not exist in the index.
3fill in blank
hard

Fix the error in the SQL query that selects all rows from the 'products' table.

Elasticsearch
SELECT * FROM [1];
Drag options to blanks, or click blank then click option'
Aproducts
Bproduct
Cproduct_list
Ditems
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'product' instead of 'products'.
Using a table name that does not exist.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps product names to their prices for products costing more than 100.

Elasticsearch
{product['[1]']: product['[2]'] for product in products if product['price'] > 100}
Drag options to blanks, or click blank then click option'
Aname
Bprice
Ccategory
Dstock
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'category' or 'stock' instead of 'name' or 'price'.
Mixing up keys and values in the dictionary comprehension.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase product names to their prices for products with stock greater than 0.

Elasticsearch
{product['[1]'].upper(): product['[2]'] for product in products if product['[3]'] > 0}
Drag options to blanks, or click blank then click option'
Aname
Bprice
Cstock
Dcategory
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'category' instead of 'stock' in the condition.
Swapping 'price' and 'stock' fields.