0
0
Elasticsearchquery~10 mins

Wildcard and prefix queries in Elasticsearch - Interactive Code Practice

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

Complete the code to create a wildcard query that matches any word starting with "test".

Elasticsearch
{
  "query": {
    "wildcard": {
      "field": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"*test"
B"test?"
C"test"
D"test*"
Attempts:
3 left
💡 Hint
Common Mistakes
Using ? instead of * for multiple characters
Not including the wildcard symbol
Placing * before the word instead of after
2fill in blank
medium

Complete the code to create a prefix query that matches all words starting with "pre".

Elasticsearch
{
  "query": {
    "prefix": {
      "field": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"pre"
B"pre*"
C"prefix"
D"*pre"
Attempts:
3 left
💡 Hint
Common Mistakes
Adding * wildcard in prefix query
Using the full word instead of prefix
Using wildcard query syntax instead of prefix
3fill in blank
hard

Fix the error in the wildcard query pattern to match words ending with "ing".

Elasticsearch
{
  "query": {
    "wildcard": {
      "field": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"ing*"
B"*ing"
C"?ing"
D"ing"
Attempts:
3 left
💡 Hint
Common Mistakes
Placing * after "ing" instead of before
Using ? instead of * for multiple characters
Not using any wildcard
4fill in blank
hard

Fill both blanks to create a wildcard query matching words containing "cat" anywhere.

Elasticsearch
{
  "query": {
    "wildcard": {
      "field": [1],
      "value": [2]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"description"
B"*cat*"
C"title"
D"cat*"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a prefix pattern instead of wildcard with * on both sides
Choosing a wrong field name
Omitting the wildcard characters
5fill in blank
hard

Fill all three blanks to create a prefix query on "name" field with prefix "jo" and boost it by 2.0.

Elasticsearch
{
  "query": {
    "prefix": {
      [1]: {
        "value": [2],
        "boost": [3]
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"name"
B"jo"
C2.0
D"john"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the prefix value as the field name
Omitting the boost or using wrong boost value
Using a full word instead of prefix