﻿---
title: stack es knn-eval cli command
description: Evaluate kNN search settings. Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4948/reference/elastic-cli/cli/stack/es/knn-eval
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack es knn-eval cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack es knn-eval \
  --field <field> \
  --k <k> \
  --query-source <query-source> \
  --knn-settings <knn-settings> \
  --index <index> \
  [options]
```

Evaluate kNN search settings.
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--field string required">
    The `dense_vector` field to evaluate.
  </definition>
  <definition term="--k number required">
    The number of nearest neighbors to compute the recall for, from 1 to 1000.
  </definition>
  <definition term="--query-source string required">
    The source of the query vectors.
  </definition>
  <definition term="--knn-settings string[] required">
    The kNN search settings to evaluate, from 1 to 32 unique entries.
    **Repeatable:** pass `--knn-settings` multiple times to supply more than one value
  </definition>
  <definition term="--index string required">
    A comma-separated list of index names to search.
    **Repeatable:** pass `--index` multiple times to supply more than one value
  </definition>
  <definition term="--ignore-unavailable">
    If `false`, the request returns an error if it targets a missing or closed index.
  </definition>
  <definition term="--allow-no-indices">
    If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.
    This behavior applies even if the request targets other open indices.
  </definition>
  <definition term="--expand-wildcards enum">
    The type of index that wildcard patterns can match.
    It supports comma-separated values, such as `open,hidden`.
    **Values:** all, open, closed, hidden, none
    **Repeatable:** pass `--expand-wildcards` multiple times to supply more than one value
  </definition>
  <definition term="--wait-for-completion">
    If `true`, the request waits for the evaluation to complete.
    A large evaluation can run for minutes, and closing the connection, for example because of a client or proxy timeout, cancels it.
    If `false`, the request returns a task identifier, and stores the completed response for retrieval through the task management API.
  </definition>
  <definition term="--baseline string">
    The settings of the search that the `knn_settings` entries are compared with.
    If not specified, it uses a `visit_percentage` of 20 and a `rescore_vector.oversample` of 100.
  </definition>
  <definition term="--allow-exact-baseline">
    If `true`, the `baseline` can be `exact`.
    An exact baseline compares every vector at full precision, and can severely slow down other searches.
  </definition>
  <definition term="--error-trace">
    When set to `true` Elasticsearch will include the full stack trace of errors
    when they occur.
  </definition>
  <definition term="--filter-path string">
    Comma-separated list of filters in dot notation which reduce the response
    returned by Elasticsearch.
    **Repeatable:** pass `--filter-path` multiple times to supply more than one value
  </definition>
  <definition term="--human">
    When set to `true` will return statistics in a format suitable for humans.
    For example `"exists_time": "1h"` for humans and
    `"exists_time_in_millis": 3600000` for computers. When disabled the human
    readable values will be omitted. This makes sense for responses being consumed
    only by machines.
  </definition>
  <definition term="--pretty">
    If set to `true` the returned JSON will be "pretty-formatted". Only use
    this option for debugging only.
  </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>