Update ranking rules
PUT
/indexes/{indexUid}/settings/ranking-rules
Update the ranking rules of an index.
To add your own ranking rule, you have to communicate either asc
for ascending order or desc
for descending order followed by the field name in brackets.
- To apply an ascending custom ranking rule:
attribute_name:asc
- To apply a descending custom ranking rule:
attribute_name:desc
If the provided index does not exist, it will be created.
Headers
-
Content-Type string Required
Payload content-type
Value is
application/json
.
Path parameters
-
indexUid string Required
Index Unique Identifier
Body Required
array[string]
array[string]
List of ranking rules sorted by order of importance. The order is customizable.
PUT /indexes/{indexUid}/settings/ranking-rules
curl \
-X PUT https://example.meilisearch.com:7700/indexes/movies/settings/ranking-rules \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '["words","typo","proximity","attribute","sort","exactness","release_date:asc"]'
Request example
# Headers
Content-Type: application/json
# Payload
[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:asc"
]
Response examples (202)
{
"taskUid": 0,
"indexUid": "movies",
"status": "enqueued",
"type": "settingsUpdate",
"enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (401)
{
"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"
}