पाठ 10 / 25
Full-Text Queries: match, multi_match, match_phrase
Analysed queries that score.
Queries that understand text
match analyses the query text and finds documents containing the terms; by default any term can match (operator: or), and you can require all with operator: and or a minimum_should_match such as "75%". fuzziness: "AUTO" tolerates small typos. multi_match runs a match over several fields with optional boosts (title^3); its type controls how per-field scores combine: best_fields (default, the best single field wins), most_fields (sum across fields), cross_fields (treat fields as one big field, good for names split across first/last), and phrase/phrase_prefix. match_phrase requires the terms in order and adjacent, with slop allowing some distance between them.
Asking precise questions
Full-text queries score relevance, term-level queries filter exactly, and bool combines them.
Three full-text queries
Kibana Dev Tools console syntax; send the same requests with curl or a client library.
GET /products/_search
{
"query": {
"match": {
"name": { "query": "waterproof jaket", "operator": "and", "fuzziness": "AUTO" }
}
}
}
GET /products/_search
{
"query": {
"multi_match": {
"query": "trail running shoe",
"fields": [ "name^3", "brand^2", "description" ],
"type": "best_fields"
}
}
}
GET /products/_search
{
"query": {
"match_phrase": { "description": { "query": "machine washable", "slop": 1 } }
}
}Start with multi_match and boosts
For a typical search box, multi_match over a few fields with a higher boost on the title is a solid baseline; tune with real queries rather than guesses.
त्वरित जाँच: Which query requires its terms to appear in order and near each other?
- match_phrase
- match with operator or
- term
- exists
Answer
match_phrase — match_phrase uses term positions; slop relaxes adjacency.