0
0
Elasticsearchquery~10 mins

Why advanced search improves user experience in Elasticsearch - Test Your Understanding

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

Complete the code to perform a basic match query in Elasticsearch.

Elasticsearch
{
  "query": {
    "match": {
      "title": "[1]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Asearch term
Bfilter
Chighlight
Dsort
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter' or 'sort' instead of the search term.
2fill in blank
medium

Complete the code to add a filter for documents where the status is 'active'.

Elasticsearch
{
  "query": {
    "bool": {
      "filter": {
        "term": { "status": "[1]" }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aactive
Binactive
Cpending
Ddeleted
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a wrong status value like 'inactive'.
3fill in blank
hard

Fix the error in the query to correctly combine a match and a range filter.

Elasticsearch
{
  "query": {
    "bool": {
      "must": {
        "match": { "description": "[1]" }
      },
      "filter": {
        "range": { "price": { "gte": 10 } }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Acheap
Bpremium
Cexpensive
Ddiscount
Attempts:
3 left
💡 Hint
Common Mistakes
Using terms unrelated to price or discounts.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters words longer than 4 characters.

Elasticsearch
{word: len(word) for word in words if [1] [2] 4}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' or using 'word' instead of length.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that includes uppercase keys, values, and filters values greater than 0.

Elasticsearch
result = { [1]: [2] for k, v in data.items() if v [3] 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase keys or wrong comparison operators.