Skip to content

Get multiple documents

Gets a selection of documents based on their IDs.

This endpoint accepts the application/json content type.


GET /indexes/{index_name}/documents

Path parameters

Name Type Description
index_name String name of the index

Query parameters

Search parameter Type Default value Description
expose_facets
Boolean False If true, the documents' tensor facets are returned. This is a list of objects. Each facet object contains document data and its associated embedding (found in the facet's _embedding field)

Body

An array of IDs. Each ID is a string.

["article_152", "article_490", "article_985"]

Example

curl -XGET http://localhost:8882/indexes/my-first-index/documents -H 'Content-Type: application/json' -d '
    ["article_152", "article_490", "article_985"]
'
mq.index("my-first-index").get_documents(
    document_ids=["article_152", "article_490", "article_985"]
)

Response 200 OK

{'results': [{'Blurb': 'A rocket car is a car powered by a rocket engine. This '
                       'treatise proposes that rocket cars are the inevitable '
                       'future of land-based transport.',
              'Title': 'Treatise on the viability of rocket cars',
              '_found': true,
              '_id': 'article_152'},
             {'_found': false, '_id': 'article_490'},
             {'Blurb': "One must maintain one's space suite. It is, after all, "
                       'the tool that will help you explore distant galaxies.',
              'Title': 'Your space suit and you',
              '_found': true,
              '_id': 'article_985'}]}
In this response, the index has no document with and ID of article_490. As a result, the _found field is false.