HTTP request
curl \
-X GET 'MEILISEARCH_URL/dynamic-search-rules/black-friday' \
-H 'Authorization: Bearer API_KEY'client.getDynamicSearchRule('RULE_UID')$client->getDynamicSearchRule('RULE_UID');client.get_dynamic_search_rule('black-friday')DynamicSearchRule rule = client.getDynamicSearchRule("black-friday");client.GetSearchRule("black-friday")await client.GetDynamicSearchRuleAsync("black-friday");require 'uri'
require 'net/http'
url = URI("http://localhost:7700/dynamic-search-rules/{uid}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"uid": "black-friday",
"description": "Black Friday 2025 rules",
"precedence": 10,
"active": true,
"conditions": {
"query": {
"isEmpty": true
},
"time": {
"start": "2025-11-28T00:00:00Z",
"end": "2025-11-28T23:59:59Z"
}
},
"actions": {
"pin": [
{
"indexUid": "products",
"id": "123",
"position": 1
}
]
}
}{
"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"
}{
"message": "Dynamic search rule `black-friday` not found.",
"code": "dynamic_search_rule_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#dynamic_search_rule_not_found"
}Search Rules
Get a search rule
Retrieve a single search rule by its unique identifier.
GET
/
dynamic-search-rules
/
{uid}
HTTP request
curl \
-X GET 'MEILISEARCH_URL/dynamic-search-rules/black-friday' \
-H 'Authorization: Bearer API_KEY'client.getDynamicSearchRule('RULE_UID')$client->getDynamicSearchRule('RULE_UID');client.get_dynamic_search_rule('black-friday')DynamicSearchRule rule = client.getDynamicSearchRule("black-friday");client.GetSearchRule("black-friday")await client.GetDynamicSearchRuleAsync("black-friday");require 'uri'
require 'net/http'
url = URI("http://localhost:7700/dynamic-search-rules/{uid}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"uid": "black-friday",
"description": "Black Friday 2025 rules",
"precedence": 10,
"active": true,
"conditions": {
"query": {
"isEmpty": true
},
"time": {
"start": "2025-11-28T00:00:00Z",
"end": "2025-11-28T23:59:59Z"
}
},
"actions": {
"pin": [
{
"indexUid": "products",
"id": "123",
"position": 1
}
]
}
}{
"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"
}{
"message": "Dynamic search rule `black-friday` not found.",
"code": "dynamic_search_rule_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#dynamic_search_rule_not_found"
}Authorizations
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' });
Response
Dynamic search rule returned.
Precedence of the dynamic search rule. Lower numeric values take precedence over higher ones. If omitted, the rule is treated as having the lowest precedence. This precedence is used to resolve conflicts between matching rules:
- If the same document is selected by multiple rules, the smallest
prioritynumber wins - If different documents are pinned to the same position, they are ordered by ascending
priority
Required range:
x >= 0