# Create or update a query ruleset **PUT /_query_rules/{ruleset_id}** There is a limit of 100 rules per ruleset. This limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting. IMPORTANT: Due to limitations within pinned queries, you can only select 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. ## Required authorization * Cluster privileges: `manage_search_query_rules` [Edit rules and rulesets from the Query Rules UI](https://www.elastic.co/docs/solutions/search/query-rules-ui#edit-a-rule) ## Servers - http://api.example.com: http://api.example.com () ## Authentication methods - Api key auth - Basic auth - Bearer auth ## Parameters ### Path parameters - **ruleset_id** (string) The unique identifier of the query ruleset to be created or updated. ### Body: application/json (object) - **rules** (object | array[object]) ## Responses ### 200 #### Body: application/json (object) - **result** (string) [Powered by Bump.sh](https://bump.sh)