Get query ruleset
Get query ruleset
New API reference
For the most up-to-date API details, refer to Query rules APIs.
Retrieves information about a query ruleset.
Request
GET _query_rules/<ruleset_id>
Prerequisites
Requires the manage_search_query_rules
privilege.
Path parameters
<ruleset_id>
(Required, string)
Response codes
400
The ruleset_id
was not provided.
404
(Missing resources)
No query ruleset matching ruleset_id
could be found.
Examples
The following example gets the query ruleset named my-ruleset
:
resp = client.query_rules.get_ruleset(
ruleset_id="my-ruleset",
)
print(resp)
const response = await client.transport.request({
method: "GET",
path: "/_query_rules/my-ruleset",
});
console.log(response);
GET _query_rules/my-ruleset/
A sample response:
{
"ruleset_id": "my-ruleset",
"rules": [
{
"rule_id": "my-rule1",
"type": "pinned",
"criteria": [
{
"type": "contains",
"metadata": "query_string",
"values": [ "pugs", "puggles" ]
}
],
"actions": {
"ids": [
"id1",
"id2"
]
}
},
{
"rule_id": "my-rule2",
"type": "pinned",
"criteria": [
{
"type": "fuzzy",
"metadata": "query_string",
"values": [ "rescue dogs" ]
}
],
"actions": {
"docs": [
{
"_index": "index1",
"_id": "id3"
},
{
"_index": "index2",
"_id": "id4"
}
]
}
}
]
}
当前内容版权归 elasticsearch 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 elasticsearch .