0
0
Elasticsearchquery~20 mins

Multi-match query in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-match Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this multi-match query?

Given the following Elasticsearch multi-match query, what will be the value of hits.total.value if the index contains 3 documents matching the query?

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "quick brown fox",
      "fields": ["title", "description"]
    }
  }
}
A3
B0
CError: missing operator
D1
Attempts:
2 left
💡 Hint

Multi-match queries search multiple fields and return all matching documents.

🧠 Conceptual
intermediate
1:30remaining
Which option best describes the type parameter in a multi-match query?

In an Elasticsearch multi-match query, what does the type parameter control?

AThe output format of the search results
BThe way the query terms are matched across fields
CThe type of documents to search
DThe index to run the query on
Attempts:
2 left
💡 Hint

Think about how the query behaves when matching terms in multiple fields.

🔧 Debug
advanced
2:00remaining
What error does this multi-match query produce?

Consider this multi-match query with a syntax mistake. What error will Elasticsearch return?

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "search text",
      "fields": "title description"
    }
  }
}
ANo error, query runs successfully
BError: missing query parameter
CSyntaxError: fields must be an array
DTypeError: query must be a string
Attempts:
2 left
💡 Hint

Check the type of the fields parameter.

📝 Syntax
advanced
2:00remaining
Which option correctly uses fuzziness in a multi-match query?

Choose the valid multi-match query that applies fuzziness to allow approximate matches.

A{ "query": { "multi_match": { "query": "apple", "fields": "name", "fuzziness": 2 } } }
B{ "query": { "multi_match": { "query": "apple", "fields": ["name"] } } }
C{ "query": { "multi_match": { "query": "apple", "fields": ["name"], "fuzziness": true } } }
D{ "query": { "multi_match": { "query": "apple", "fields": ["name"], "fuzziness": "AUTO" } } }
Attempts:
2 left
💡 Hint

Fuzziness must be a string like "AUTO" or a number, and fields must be an array.

🚀 Application
expert
3:00remaining
How many documents will match this multi-match query with operator set to and?

Assume the index has these documents:

  • Doc1: title="fast fox", description="quick brown animal"
  • Doc2: title="slow fox", description="lazy brown animal"
  • Doc3: title="fast dog", description="quick brown animal"

What is the number of documents matched by this query?

Elasticsearch
{
  "query": {
    "multi_match": {
      "query": "quick brown",
      "fields": ["title", "description"],
      "operator": "and"
    }
  }
}
A2
B3
C1
D0
Attempts:
2 left
💡 Hint

With operator set to and, all query terms must appear in the fields.