API reference
Similar documents
The /similar route accepts one search result and uses AI-powered search to return a number of similar documents.
The /similar
route uses AI-powered search to return a number of documents similar to a target document.
Meilisearch exposes two routes for retrieving similar documents: POST
and GET
. In the majority of cases, POST
will offer better performance and ease of use.
Get similar documents with POST
POST
/indexes/{index_uid}/similar
Retrieve documents similar to a specific search result.
Path parameters
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Body
Parameter | Type | Default value | Description |
---|---|---|---|
id | String or number | null | Identifier of the target document (mandatory) |
embedder | String | null | Embedder to use when computing recommendations. Mandatory |
attributesToRetrieve | Array of strings | ["*"] | Attributes to display in the returned documents |
offset | Integer | 0 | Number of documents to skip |
limit | Integer | 20 | Maximum number of documents returned |
filter | String | null | Filter queries by an attribute’s value |
showRankingScore | Boolean | false | Display the global ranking score of a document |
showRankingScoreDetails | Boolean | false | Display detailed ranking score information |
rankingScoreThreshold | Number | null | Exclude results with low ranking scores |
retrieveVectors | Boolean | false | Return document vector data |
Example
Response: 200 OK
Get similar documents with GET
GET
/indexes/{index_uid}/similar
Retrieve documents similar to a specific search result.
Path parameters
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Query parameters
Parameter | Type | Default value | Description |
---|---|---|---|
id | String or number | null | Identifier of the target document (mandatory) |
embedder | String | "default" | Embedder to use when computing recommendations. Mandatory |
attributesToRetrieve | Array of strings | ["*"] | Attributes to display in the returned documents |
offset | Integer | 0 | Number of documents to skip |
limit | Integer | 20 | Maximum number of documents returned |
filter | String | null | Filter queries by an attribute’s value |
showRankingScore | Boolean | false | Display the global ranking score of a document |
showRankingScoreDetails | Boolean | false | Display detailed ranking score information |
rankingScoreThreshold | Number | null | Exclude results with low ranking scores |
retrieveVectors | Boolean | false | Return document vector data |
Example
Response: 200 OK
Was this page helpful?