﻿---
title: stack kb data-views-v2 put-data-views-v2-id cli command
description: Upsert a data view Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/5002/reference/elastic-cli/cli/stack/kb/data-views-v2/put-data-views-v2-id
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack kb data-views-v2 put-data-views-v2-id cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack kb data-views-v2 put-data-views-v2-id \
  --id <id> \
  --index-pattern <index-pattern> \
  [options]
```

Upsert a data view
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--id string required">
    The ID of the data view to create or update.
  </definition>
  <definition term="--index-pattern string required">
  </definition>
  <definition term="--allow-hidden-indices">
    When `true`, allows the data view to match hidden indices.
  </definition>
  <definition term="--field-filters string[]">
    **Repeatable:** pass `--field-filters` multiple times to supply more than one value
  </definition>
  <definition term="--field-settings string">
    Settings for individual fields, keyed by field name. To change how Kibana displays a field from the backing indices, set its label, description, format, or popularity. To define a runtime field, use the runtime field name and set `type`.
  </definition>
  <definition term="--name string">
    The name of the data view. Example: "Sample data view".
  </definition>
  <definition term="--time-field string">
  </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>
  <definition term="--no-validate">
    skip input validation and send the request as-is
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--output-fields string">
    comma-separated list of fields to include in output (dot-notation supported)
  </definition>
  <definition term="--output-template string">
    Mustache-like template for custom text output (e.g. "{{id}}: {{name}}")
  </definition>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>