Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›REST API ›API правил запросов

Получение набора правил запроса

Справочник по новым API

Для получения самых последних деталей API, обратитесь к API правил запросов.

Получает информацию о наборе правил запроса.

Запрос

GET _query_rules/<ruleset_id>

Предварительные условия

Требуется привилегия manage_search_query_rules.

Параметры пути

<ruleset_id>
(Обязательно, строка)

Коды ответов

400
ruleset_id не было предоставлено.
404 (Отсутствующие ресурсы)
Не удалось найти набор правил запроса, соответствующий ruleset_id.

Примеры

В следующем примере получается набор правил запроса с именем 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/

Пример ответа:

{
    "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"
                    }
                ]
            }
        }
    ]
}

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-query-ruleset.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API