What does a multi-match query do in Elasticsearch?
ASearches for a text in multiple fields at once
BUpdates multiple documents simultaneously
CDeletes multiple fields from documents
DIndexes multiple documents in one request
✗ Incorrect
A multi-match query searches for the given text across multiple fields in the documents.
Which parameter lists the fields to search in a multi-match query?
Aoperator
Bfields
Cquery
Dtype
✗ Incorrect
The 'fields' parameter specifies which fields to search in.
What is the default type for a multi-match query?
Amost_fields
Bphrase
Ccross_fields
Dbest_fields
✗ Incorrect
The default type is 'best_fields', which finds the single best matching field.
If you want all words in the query to match, which operator should you use?
Aand
Bexists
Cnot
Dor
✗ Incorrect
The 'and' operator requires all words to match in the fields.
Which multi-match type treats multiple fields as one combined field for matching?
Abest_fields
Bmost_fields
Ccross_fields
Dphrase
✗ Incorrect
The 'cross_fields' type treats fields as one combined field to match terms.
Explain how a multi-match query works and when you would use it.
Think about searching a book by title and author at the same time.
You got /4 concepts.
Describe the difference between 'best_fields' and 'cross_fields' types in a multi-match query.
Imagine searching for a phrase split across two fields.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of a multi-match query in Elasticsearch?
easy
A. To search multiple fields with a single query
B. To update multiple documents at once
C. To delete multiple indexes simultaneously
D. To create multiple indexes in one request
Solution
Step 1: Understand the multi-match query concept
A multi-match query allows searching across several fields in one query, making it easier to find matches in different parts of documents.
Step 2: Compare with other options
The other options describe operations like creating indexes, updating documents, or deleting indexes, which are not the purpose of multi-match queries.
Final Answer:
To search multiple fields with a single query -> Option A
Quick Check:
Multi-match = search multiple fields [OK]
Hint: Multi-match searches many fields at once [OK]
Common Mistakes:
Confusing multi-match with update or delete operations
Thinking it creates or deletes indexes
Assuming it searches only one field
2. Which of the following is the correct syntax to perform a multi-match query searching for the word "apple" in fields "title" and "description"?
The "fields" key must be an array of field names, not a single string with commas.
Step 2: Validate other keys
The "query" key is correctly a string. "multi_match" is the correct query type. "fields" should not be omitted.
Final Answer:
"fields" should be an array, not a string -> Option B
Quick Check:
fields must be array, not comma string [OK]
Hint: Fields must be an array, not a comma string [OK]
Common Mistakes:
Passing fields as a comma-separated string
Changing multi_match to match incorrectly
Thinking query must be an array
5. You want to search for the term "coffee" giving higher importance to the "title" field than "description" and "tags" fields. Which multi-match query correctly applies this weighting?