0
0
Elasticsearchquery~10 mins

Multi-match query 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 search multiple fields using a multi-match query.

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "Elasticsearch",
      "fields": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"content"
B["title", "content"]
C["author"]
D"title"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single string instead of a list for multiple fields.
Forgetting to use quotes around field names.
2fill in blank
medium

Complete the code to set the multi-match query type to 'phrase'.

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "quick brown fox",
      "fields": ["title", "content"],
      "type": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"phrase"
B"most_fields"
C"best_fields"
D"cross_fields"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default type and expecting phrase matching.
Using an invalid type string.
3fill in blank
hard

Fix the error in the multi-match query by completing the missing parameter to boost the 'title' field.

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "Elasticsearch tutorial",
      "fields": ["title[1]", "content"]
    }
  }
}
Drag options to blanks, or click blank then click option'
A-2
B*2
C:2
D^2
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect symbols like * or : for boosting.
Not adding any boost and expecting higher relevance.
4fill in blank
hard

Fill both blanks to create a multi-match query that searches 'title' and 'summary' fields and uses the 'cross_fields' type.

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "open source",
      "fields": [[1], [2]],
      "type": "cross_fields"
    }
  }
}
Drag options to blanks, or click blank then click option'
A"title"
B"content"
C"summary"
D"author"
Attempts:
3 left
💡 Hint
Common Mistakes
Including wrong field names like 'content' or 'author'.
Not matching the fields to the query intent.
5fill in blank
hard

Fill all three blanks to build a multi-match query that searches 'title' boosted by 3, 'description', and 'tags' fields, using the 'most_fields' type.

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "machine learning",
      "fields": [[1], [2], [3]],
      "type": "most_fields"
    }
  }
}
Drag options to blanks, or click blank then click option'
A"title^3"
B"description"
C"tags"
D"content"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to boost the 'title' field.
Including unrelated fields like 'content'.