Complete the code to search multiple fields using a multi-match query.
{
"query": {
"multi_match": {
"query": "Elasticsearch",
"fields": [1]
}
}
}The fields parameter expects a list of fields to search. Using ["title", "content"] searches both fields.
Complete the code to set the multi-match query type to 'phrase'.
{
"query": {
"multi_match": {
"query": "quick brown fox",
"fields": ["title", "content"],
"type": [1]
}
}
}Setting type to "phrase" makes the query look for exact phrase matches across the fields.
Fix the error in the multi-match query by completing the missing parameter to boost the 'title' field.
{
"query": {
"multi_match": {
"query": "Elasticsearch tutorial",
"fields": ["title[1]", "content"]
}
}
}Adding ^2 after a field name boosts its importance by 2 in the search results.
Fill both blanks to create a multi-match query that searches 'title' and 'summary' fields and uses the 'cross_fields' type.
{
"query": {
"multi_match": {
"query": "open source",
"fields": [[1], [2]],
"type": "cross_fields"
}
}
}The fields list should include "title" and "summary" to search both fields with the cross_fields type.
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.
{
"query": {
"multi_match": {
"query": "machine learning",
"fields": [[1], [2], [3]],
"type": "most_fields"
}
}
}The fields list includes "title^3" to boost the title field by 3, plus "description" and "tags". The most_fields type searches all fields and combines scores.