﻿---
title: stack kb alerting-v2 post-alerting-v2-rules-disable-by-query cli command
description: Disable rules matching a query (dry-run by default) Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4120/reference/elastic-cli/cli/stack/kb/alerting-v2/post-alerting-v2-rules-disable-by-query
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack kb alerting-v2 post-alerting-v2-rules-disable-by-query cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack kb alerting-v2 post-alerting-v2-rules-disable-by-query [options]
```

Disable rules matching a query (dry-run by default)
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--filter string">
    KQL filter string to match target resources. At most 10000 matching resources are processed per request. Cannot be empty; to target every resource use `match_all: true`.
  </definition>
  <definition term="--force">
    When true, executes the operation. When false (default), returns a dry-run preview with `match_count` and a `sample` of matching resource IDs so the client can verify before committing.
  </definition>
  <definition term="--match-all enum">
    When true, targets every resource. Requires an explicit opt-in. Omitted by default.
    **Values:** true
  </definition>
  <definition term="--search string">
    Free-text search string matched against the resource-defined searchable fields. Cannot be empty; to target every resource use `match_all: true`.
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>