younifyd
Menu

Validate query (GET /_validate/query)

Validate query

GET/_validate/query

Use it in a workflow

  1. Add a step and choose the OpenSearch connector.
  2. Pick the Validate query (GET /_validate/query) action (under indices).
  3. Fill in the fields below, then reference the result from later steps as {{validateQueryGetValidateQuery.response.data}}.

Request

Query parameters

all_shardsboolean

If `true`, the validation is executed on all shards instead of one random shard per index.

allow_no_indicesboolean

If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes.

analyze_wildcardboolean

If `true`, wildcard and prefix queries are analyzed.

Default false

analyzerstring

Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified.

default_operatorstring

The default operator for query string query: `AND` or `OR`.

dfstring

Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified.

expand_wildcardsoneOf

Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.

explainboolean

If `true`, the response returns detailed information if an error has occurred.

ignore_unavailableboolean

If `false`, the request returns an error if it targets a missing or closed index.

lenientboolean

If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.

qstring

Query in the Lucene query string syntax.

rewriteboolean

If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed.

prettyboolean

Whether to pretty-format the returned JSON response.

Default false

humanboolean

Whether to return human-readable values for statistics.

Default false

error_traceboolean

Whether to include the stack trace of returned errors.

Default false

sourcestring

The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

filter_pathoneOf

A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`.

Response

Returns 200 with an object. Read it in later steps with {{validateQueryGetValidateQuery.response.data.<field>}}.

explanationsarray<object>
errorstring

The error message if validation failed.

explanationstring

The explanation of why the query is valid or invalid.

indexstringrequired
validbooleanrequired

Whether the query is valid for the index.

_shardsobject
failedintegerrequired
successfulintegerrequired
totalintegerrequired
failuresarray<object>4 fields
skippedinteger
validboolean
errorstring
json
{
  "valid": false,
  "explanations": [
    {
      "index": "string",
      "valid": false,
      "error": "string",
      "explanation": "string"
    }
  ],
  "_shards": {
    "failed": 0,
    "successful": 0,
    "total": 0,
    "failures": [
      {
        "shard": 0,
        "reason": {
          "type": "string",
          "reason": "string",
          "stack_trace": "string",
          "caused_by": {},
          "root_cause": [
            {}
          ],
          "suppressed": [
            {}
          ],
          "header": {}
        },
        "index": "string",
        "node": "string"
      }
    ],
    "skipped": 0
  },
  "error": "string"
}

Need more? See the OpenSearch guide for connection setup and behaviour shared by every action.