﻿---
title: stack kb context-engine put-context-engine-ai-index-aiindexid cli command
description: Create or update an AI Index Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4384/reference/elastic-cli/cli/stack/kb/context-engine/put-context-engine-ai-index-aiindexid
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack kb context-engine put-context-engine-ai-index-aiindexid cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack kb context-engine put-context-engine-ai-index-aiindexid \
  --ai-index-id <ai-index-id> \
  --dest <dest> \
  [options]
```

Create or update an AI Index
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--ai-index-id string required">
    The unique identifier of the AI Index.
  </definition>
  <definition term="--dest string required">
    The data stream or index that backs the AI Index.
  </definition>
  <definition term="--automations string[]">
    Automations associated with the AI Index. Defaults to an empty array when omitted.
    **Repeatable:** pass `--automations` multiple times to supply more than one value
  </definition>
  <definition term="--description string">
    Human-readable description of the AI Index.
  </definition>
  <definition term="--feedback-analysis string">
    The recurring feedback analysis, which reads agent signals and proposes improvement actions for the AI Index.
  </definition>
  <definition term="--sources string[]">
    Additional sources that provide context for the AI Index. Defaults to an empty array when omitted.
    **Repeatable:** pass `--sources` multiple times to supply more than one value
  </definition>
  <definition term="--traces string[]">
    Trace sources linked to this AI Index. A write replaces the whole array. Defaults to an empty array when omitted.
    **Repeatable:** pass `--traces` multiple times to supply more than one value
  </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>