Retrieve documents similar to a reference document identified by its id.
Useful for “more like this” or recommendations.
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'
});Unique identifier of the index.
The unique identifier (primary key value) of the target document. Meilisearch will find and return documents that are semantically similar to this document based on their vector embeddings. This is a required parameter.
The name of the embedder to use for finding similar documents. This must match one of the embedders configured in your index settings. The embedder determines how document similarity is calculated based on vector embeddings.
Number of similar documents to skip in the response. Use together with
limit for pagination through large result sets. For example, to get
similar documents 21-40, set offset=20 and limit=20. Defaults to
0.
x >= 0Maximum number of similar documents to return in a single response. Use
together with offset for pagination. Higher values return more
results but may increase response time. Defaults to 20.
x >= 0Comma-separated list of document attributes to include in the response.
Use * to retrieve all attributes. By default, all attributes listed
in the displayedAttributes setting are returned. Example:
title,description,price.
When true, includes the vector embeddings for each returned document.
Useful for debugging or when you need to inspect the vector data. Note
that this can significantly increase response size. Defaults to
false.
Filter expression to narrow down which documents can be returned as
similar. Uses the same syntax as search filters. Only documents
matching this filter will be considered when finding similar documents.
Example: genres = action AND year > 2000.
When true, includes a global _rankingScore field in each document
showing how similar it is to the target document. The score is a value
between 0 and 1, where higher values indicate greater similarity.
Defaults to false.
When true, includes a detailed _rankingScoreDetails object in each
document breaking down how the similarity score was calculated. Useful
for debugging and understanding why certain documents are considered
more similar. Defaults to false.
When true, includes a _performanceDetails object showing the
performance details of the search.
Minimum ranking score threshold (between 0.0 and 1.0) that documents must meet to be included in results. Documents with a similarity score below this threshold will be excluded. Useful for ensuring only highly similar documents are returned.
The documents are returned.
Response containing similar documents
Number of results on each page
x >= 0Current search results page
x >= 0Exhaustive total number of search result pages
x >= 0Exhaustive total number of matches
x >= 0Results of the query
Document ID that was used as reference
Processing time of the query in milliseconds
x >= 0Performance details of the query