Get query rulesetedit

This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

Retrieves information about a query ruleset.

Requestedit

GET _query_rules/<ruleset_id>

Prerequisitesedit

Requires the manage_search_query_rules privilege.

Path parametersedit

<ruleset_id>
(Required, string)

Response codesedit

400
The ruleset_id was not provided.
404 (Missing resources)
No query ruleset matching ruleset_id could be found.

Examplesedit

The following example gets the query ruleset named my-ruleset:

GET _query_rules/my-ruleset/

A sample response:

{
    "ruleset_id": "my-ruleset",
    "rules": [
        {
            "rule_id": "my-rule1",
            "type": "pinned",
            "criteria": [
                {
                    "type": "exact",
                    "metadata": "query_string",
                    "values": [ "marvel" ]
                }
            ],
            "actions": {
                "ids": [
                    "id1",
                    "id2"
                ]
            }
        },
        {
            "rule_id": "my-rule2",
            "type": "pinned",
            "criteria": [
                {
                    "type": "exact",
                    "metadata": "query_string",
                    "values": [ "dc" ]
                }
            ],
            "actions": {
                "docs": [
                    {
                        "_index": "index1",
                        "_id": "id3"
                    },
                    {
                        "_index": "index2",
                        "_id": "id4"
                    }
                ]
            }
        }
    ]
}