You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update example in query rules docs
* Ensure GET docs are also consistent
* Update docs/reference/query-rules/apis/put-query-ruleset.asciidoc
---------
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/reference/query-rules/apis/put-query-ruleset.asciidoc
+36-36Lines changed: 36 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,29 +22,27 @@ Requires the `manage_search_query_rules` privilege.
22
22
23
23
[role="child_attributes"]
24
24
[[put-query-ruleset-request-body]]
25
-
(Required, object)
26
-
Contains parameters for a query ruleset:
25
+
(Required, object) Contains parameters for a query ruleset:
27
26
28
27
==== {api-request-body-title}
28
+
29
29
`rules`::
30
-
(Required, array of objects)
31
-
The specific rules included in this query ruleset.
30
+
(Required, array of objects) The specific rules included in this query ruleset.
32
31
33
32
Each rule must have the following information:
34
33
35
-
- `rule_id` (Required, string)
36
-
A unique identifier for this rule.
37
-
- `type` (Required, string)
38
-
The type of rule. At this time only `pinned` query rule types are allowed.
39
-
- `criteria` (Required, array of objects)
40
-
The criteria that must be met for the rule to be applied. If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied.
41
-
- `actions` (Required, object)
42
-
The actions to take when the rule is matched. The format of this action depends on the rule type.
34
+
- `rule_id` (Required, string) A unique identifier for this rule.
35
+
- `type` (Required, string) The type of rule.
36
+
At this time only `pinned` query rule types are allowed.
37
+
- `criteria` (Required, array of objects) The criteria that must be met for the rule to be applied.
38
+
If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied.
39
+
- `actions` (Required, object) The actions to take when the rule is matched.
40
+
The format of this action depends on the rule type.
43
41
44
42
Criteria must have the following information:
45
43
46
-
- `type` (Required, string)
47
-
The type of criteria. The following criteria types are supported:
44
+
- `type` (Required, string) The type of criteria.
45
+
The following criteria types are supported:
48
46
+
49
47
--
50
48
- `exact`
@@ -77,30 +75,32 @@ Only applicable for numerical values.
77
75
- `always`
78
76
Matches all queries, regardless of input.
79
77
--
80
-
- `metadata` (Optional, string)
81
-
The metadata field to match against. Required for all criteria types except `global`.
82
-
- `values` (Optional, array of strings)
83
-
The values to match against the metadata field. Only one value must match for the criteria to be met. Required for all criteria types except `global`.
78
+
- `metadata` (Optional, string) The metadata field to match against.
79
+
This metadata will be used to match against `match_criteria` sent in the <<query-dsl-rule-query>>.
80
+
Required for all criteria types except `global`.
81
+
- `values` (Optional, array of strings) The values to match against the metadata field.
82
+
Only one value must match for the criteria to be met.
83
+
Required for all criteria types except `global`.
84
84
85
85
Actions depend on the rule type.
86
86
For `pinned` rules, actions follow the format specified by the <<query-dsl-pinned-query,Pinned Query>>.
87
87
The following actions are allowed:
88
88
89
-
- `ids` (Optional, array of strings)
90
-
The The unique <<mapping-id-field, document IDs>> of the documents to pin.
91
-
Only one of `ids` or `docs` may be specified, and at least one must be specified.
92
-
- `docs` (Optional, array of objects)
93
-
The documents to pin. Only one of `ids` or `docs` may be specified, and at least one must be specified.
94
-
You can specify the following attributes for each document:
89
+
- `ids` (Optional, array of strings) The unique <<mapping-id-field, document IDs>> of the documents to pin.
90
+
Only one of `ids` or `docs` may be specified, and at least one must be specified.
91
+
- `docs` (Optional, array of objects) The documents to pin.
92
+
Only one of `ids` or `docs` may be specified, and at least one must be specified.
93
+
You can specify the following attributes for each document:
95
94
+
96
95
--
97
-
- `_index` (Required, string)
98
-
The index of the document to pin.
99
-
- `_id` (Required, string)
100
-
The unique <<mapping-id-field, document ID>>.
96
+
- `_index` (Required, string) The index of the document to pin.
97
+
- `_id` (Required, string) The unique <<mapping-id-field, document ID>>.
101
98
--
102
99
103
-
IMPORTANT: Due to limitations within <<query-dsl-pinned-query,Pinned queries>>, you can only pin documents using `ids` or `docs`, but cannot use both in single rule. It is advised to use one or the other in query rulesets, to avoid errors. Additionally, pinned queries have a maximum limit of 100 pinned hits. If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.
100
+
IMPORTANT: Due to limitations within <<query-dsl-pinned-query,Pinned queries>>, you can only pin documents using `ids` or `docs`, but cannot use both in single rule.
101
+
It is advised to use one or the other in query rulesets, to avoid errors.
102
+
Additionally, pinned queries have a maximum limit of 100 pinned hits.
103
+
If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.
104
104
105
105
[[put-query-ruleset-example]]
106
106
==== {api-examples-title}
@@ -109,8 +109,8 @@ The following example creates a new query ruleset called `my-ruleset`.
109
109
110
110
Two rules are associated with `my-ruleset`:
111
111
112
-
- `my-rule1` will pin documents with IDs `id1` and `id2` when `user.query` exactly matches `marvel` _or_ `dc` **and** `user.country` exactly matches `us`.
113
-
- `my-rule2` will pin documents from different, specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `comic`.
112
+
- `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` _or_ `puggles` **and** `user_country` exactly matches `us`.
113
+
- `my-rule2` will pin documents from different, specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`.
0 commit comments