# Ranking rules
Child route of the settings route.
Ranking rules are built-in rules that allow you to customize the relevancy of your search results. They are stored in an array and applied in order of appearance.
Ranking rules can also be updated directly through the global settings route along with the other settings.
To learn more about ranking rules, refer to our dedicated guide.
WARNING
Updating the settings means overwriting the default settings of Meilisearch. You can reset to default values using the DELETE routes.
# Get ranking rules
/indexes/{index_uid}/settings/ranking-rulesGet the ranking rules of an index. The index uid is required.
# Default value
An array that contains ranking rules in order of importance.
# Example
curl \
-X GET 'http://localhost:7700/indexes/movies/settings/ranking-rules'
# Response: 200 Ok
List the settings.
[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:desc"
]
# Update ranking rules
/indexes/{index_uid}/settings/ranking-rulesUpdate the ranking rules of an index. The index uid is required.
# Body
An array that contain ranking rules sorted by order of importance.
To add your own ranking rule, you have to communicate an attribute followed by a colon (:) and either asc for ascending order or desc for descending order.
To apply an ascending sort (results sorted by increasing value):
attribute_name:ascTo apply a descending sort (results sorted by decreasing value):
attribute_name:desc
More information about the body.
# Example
curl \
-X PUT 'http://localhost:7700/indexes/movies/settings/ranking-rules' \
-H 'Content-Type: application/json' \
--data-binary '[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:asc",
"rank:desc"
]'
# Response: 202 Accepted
{
"taskUid": 1,
"indexUid": "movies",
"status": "enqueued",
"type": "settingsUpdate",
"enqueuedAt": "2021-08-11T09:25:53.000000Z"
}
You can use this taskUid to get more details on the status of the task.
# Reset ranking rules
/indexes/{index_uid}/settings/ranking-rulesReset the ranking rules of an index to their default value. The index uid is required.
TIP
Note that resetting the ranking rules is not the same as removing them.
To remove a ranking rule, use the add or replace ranking rules route.
# Default value
An array that contains the built-in ranking rules in the following order:
[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness"
]
# Example
curl \
-X DELETE 'http://localhost:7700/indexes/movies/settings/ranking-rules'
# Response: 202 Accepted
{
"taskUid": 1,
"indexUid": "movies",
"status": "enqueued",
"type": "settingsUpdate",
"enqueuedAt": "2021-08-11T09:25:53.000000Z"
}
You can use this taskUid to get more details on the status of the task.