0
0
Elasticsearchquery~10 mins

Why search is Elasticsearch's core purpose - 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 search query in Elasticsearch.

Elasticsearch
GET /my_index/_search
{
  "query": {
    "match": {
      "message": "[1]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Aquery
Bsearch
Cindex
DElasticsearch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'search' instead of the actual search term.
Using 'query' or 'index' which are not the search terms.
2fill in blank
medium

Complete the code to filter search results by a specific field value.

Elasticsearch
GET /my_index/_search
{
  "query": {
    "bool": {
      "filter": {
        "term": { "status": "[1]" }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aquery
Bsearch
Cactive
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'search' or 'query' which are not valid status values.
Using 'index' which is unrelated to filtering.
3fill in blank
hard

Fix the error in the search query to correctly match documents containing the word 'fast'.

Elasticsearch
GET /my_index/_search
{
  "query": {
    "match": {
      "description": "[1]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Afast
Bfastly
Cfaster
Dfastest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'fastly' which is not a correct word.
Using comparative forms like 'faster' or 'fastest' which change the meaning.
4fill in blank
hard

Fill both blanks to create a search query that matches documents where the 'title' contains 'Elasticsearch' and the 'published' field is true.

Elasticsearch
GET /my_index/_search
{
  "query": {
    "bool": {
      "must": {
        "match": { "title": "[1]" }
      },
      "filter": {
        "term": { "published": [2] }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
AElasticsearch
Bfalse
Ctrue
Dsearch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' for the published filter which excludes published documents.
Using 'search' instead of the actual search term.
5fill in blank
hard

Fill all three blanks to create a search query that returns documents where the 'content' field contains 'fast', the 'views' field is greater than 100, and results are sorted by 'date' descending.

Elasticsearch
GET /my_index/_search
{
  "query": {
    "bool": {
      "must": {
        "match": { "content": "[1]" }
      },
      "filter": {
        "range": { "views": { "[2]": [3] } }
      }
    }
  },
  "sort": [ { "date": "desc" } ]
}
Drag options to blanks, or click blank then click option'
Afast
Bgt
C100
Dgte
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gte' instead of 'gt' changes the filter condition.
Using values other than 100 for the views filter.
Not sorting results by date descending.