Basic Search Queries
6 min read Quiz at the end
Search with match, term, multi_match, range queries and control pagination with from and size.
Basic Search Queries
# Match all
GET /posts/_search
{ "query": { "match_all": {} } }
# Full-text search on a field
GET /posts/_search
{ "query": { "match": { "title": "elasticsearch tutorial" } } }
# Exact keyword match
GET /posts/_search
{ "query": { "term": { "author": "alice" } } }
# Multiple fields
GET /posts/_search
{ "query": { "multi_match": {
"query": "docker containers",
"fields": ["title^2", "body"] # title has 2x boost
} } }
# Range query
GET /posts/_search
{ "query": { "range": { "price": { "gte": 10, "lte": 100 } } } }
# Pagination
GET /posts/_search
{ "from": 0, "size": 10, "query": { "match_all": {} } }
Topic Quiz · 1 questions
Test your understanding before moving on
1. Which query type performs full-text search with relevance scoring?
💡 match analyses the query string and searches for matching tokens with relevance scoring.