curl \
-X GET 'MEILISEARCH_URL/indexes/movies/documents?limit=2&filter=genres=action'client.index('movies').getDocuments({
limit: 2,
filter: 'genres = action',
sort: ['release_date:desc']
})$client->index('movies')->getDocuments((new DocumentsQuery())->setFilter('genres = action')->setLimit(2));client.index('movies').get_documents({
'limit':2, 'filter': 'genres=action',
'sort': ['rating:desc', 'release_date:asc'] # list format
})DocumentsQuery query = new DocumentsQuery().setLimit(2).setFilter(new String[] {"genres = action"});
client.index("movies").getDocuments(query, TargetClassName.class);client.index('movies').get_documents(limit: 2, filter: 'genres = action')var result meilisearch.DocumentsResult
client.Index("movies").GetDocuments(&meilisearch.DocumentsQuery{
Limit: 2,
Filter: "genres = action",
}, &result)await client.Index("movies").GetDocumentsAsync<Movie>(new DocumentsQuery() { Limit = 2, Filter = "genres = action" });let index = client.index("movies");
let documents: DocumentsResults = DocumentsQuery::new(&index)
.with_filter("genres = action")
.with_limit(2)
.execute::<Movies>()
.await
.unwrap();await client.index('movies').getDocuments(
params: DocumentsQuery(
limit: 2,
filter: Meili.attr('genres').eq('action'.toMeiliValue()),
),
);client.index("movies").getDocuments(params: DocumentsQuery(limit: 2)) { (result: Result<DocumentsResults<Movie>, Swift.Error>) in
switch result {
case .success(let movies):
print(movies)
case .failure(let error):
print(error)
}
}{
"results": [
{
"id": 25684,
"title": "American Ninja 5",
"poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
"overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
"release_date": 725846400
},
{
"id": 45881,
"title": "The Bridge of San Luis Rey",
"poster": "https://image.tmdb.org/t/p/w500/4X7quIcdkc24Cveg5XdpfRqxtYA.jpg",
"overview": "The Bridge of San Luis Rey is American author Thornton Wilder's second novel, first published in 1927 to worldwide acclaim. It tells the story of several interrelated people who die in the collapse of an Inca rope-fiber suspension bridge in Peru, and the events that lead up to their being on the bridge.[ A friar who has witnessed the tragic accident then goes about inquiring into the lives of the victims, seeking some sort of cosmic answer to the question of why each had to die. The novel won the Pulitzer Prize in 1928.",
"release_date": 1072915200
}
],
"limit": 20,
"offset": 0,
"total": 2
}{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}{
"message": "Index `movies` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"
}List documents with GET
Retrieve documents in batches using query parameters for offset, limit, and optional filtering. Suited for browsing or exporting index contents.
curl \
-X GET 'MEILISEARCH_URL/indexes/movies/documents?limit=2&filter=genres=action'client.index('movies').getDocuments({
limit: 2,
filter: 'genres = action',
sort: ['release_date:desc']
})$client->index('movies')->getDocuments((new DocumentsQuery())->setFilter('genres = action')->setLimit(2));client.index('movies').get_documents({
'limit':2, 'filter': 'genres=action',
'sort': ['rating:desc', 'release_date:asc'] # list format
})DocumentsQuery query = new DocumentsQuery().setLimit(2).setFilter(new String[] {"genres = action"});
client.index("movies").getDocuments(query, TargetClassName.class);client.index('movies').get_documents(limit: 2, filter: 'genres = action')var result meilisearch.DocumentsResult
client.Index("movies").GetDocuments(&meilisearch.DocumentsQuery{
Limit: 2,
Filter: "genres = action",
}, &result)await client.Index("movies").GetDocumentsAsync<Movie>(new DocumentsQuery() { Limit = 2, Filter = "genres = action" });let index = client.index("movies");
let documents: DocumentsResults = DocumentsQuery::new(&index)
.with_filter("genres = action")
.with_limit(2)
.execute::<Movies>()
.await
.unwrap();await client.index('movies').getDocuments(
params: DocumentsQuery(
limit: 2,
filter: Meili.attr('genres').eq('action'.toMeiliValue()),
),
);client.index("movies").getDocuments(params: DocumentsQuery(limit: 2)) { (result: Result<DocumentsResults<Movie>, Swift.Error>) in
switch result {
case .success(let movies):
print(movies)
case .failure(let error):
print(error)
}
}{
"results": [
{
"id": 25684,
"title": "American Ninja 5",
"poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
"overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
"release_date": 725846400
},
{
"id": 45881,
"title": "The Bridge of San Luis Rey",
"poster": "https://image.tmdb.org/t/p/w500/4X7quIcdkc24Cveg5XdpfRqxtYA.jpg",
"overview": "The Bridge of San Luis Rey is American author Thornton Wilder's second novel, first published in 1927 to worldwide acclaim. It tells the story of several interrelated people who die in the collapse of an Inca rope-fiber suspension bridge in Peru, and the events that lead up to their being on the bridge.[ A friar who has witnessed the tragic accident then goes about inquiring into the lives of the victims, seeking some sort of cosmic answer to the question of why each had to die. The novel won the Pulitzer Prize in 1928.",
"release_date": 1072915200
}
],
"limit": 20,
"offset": 0,
"total": 2
}{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}{
"message": "Index `movies` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"
}Authorizations
An API key is a token that you provide when making API calls. Read more about how to secure your project.
Include the API key to the Authorization header, for instance:
-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'
If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:
const client = new MeiliSearch({ host: 'MEILISEARCH_URL', apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1' });
Path Parameters
Unique identifier of the index.
Query Parameters
Number of documents to skip in the response. Use this parameter
together with limit to paginate through large document sets. For
example, to get documents 21-40, set offset=20 and limit=20.
Defaults to 0.
x >= 0Maximum number of documents to return in a single response. Use
together with offset for pagination. Defaults to 20.
x >= 0Comma-separated list of document attributes to include in the
response. Use * to retrieve all attributes. By default, all
attributes are returned. Example: title,description,price.
When true, includes vector embeddings in the response for documents
that have them. This is useful when you need to inspect or export
vector data. Defaults to false.
Comma-separated list of document IDs to retrieve. Only documents with matching IDs will be returned. If not specified, all documents matching other criteria are returned.
Filter expression to select which documents to return. Uses the same
syntax as search filters. Only documents matching the filter will be
included in the response. Example: genres = action AND rating > 4.
Attribute(s) to sort the documents by. Format: attribute:asc or
attribute:desc. Multiple sort criteria can be comma-separated.
Example: price:asc,rating:desc.
Response
The documents are returned.
Was this page helpful?