(Required, object) The actions to take when the rule is matched.
The format of this action depends on the rule type.
Actions depend on the rule type.
For `pinned` rules, actions follow the format specified by the <<query-dsl-pinned-query,Pinned Query>>.
The following actions are allowed:
- `ids` (Optional, array of strings) The unique <<mapping-id-field, document IDs>> of the documents to pin.
Only one of `ids` or `docs` may be specified, and at least one must be specified.
- `docs` (Optional, array of objects) The documents to pin.
Only one of `ids` or `docs` may be specified, and at least one must be specified.
You can specify the following attributes for each document:
+
--
- `_index` (Required, string) The index of the document to pin.
- `_id` (Required, string) The unique <<mapping-id-field, document ID>>.
--
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.
[[put-query-rule-example]]
==== {api-examples-title}
The following example creates a new query rule with the ID `my-rule1` in a query ruleset called `my-ruleset`.
`my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` _or_ `puggles` **and** `user_country` exactly matches `us`.