Search + K

Command Palette

Search for a command to run...

Sign In

Clear the cache

POST /{index}/_cache/clear
Copy endpoint

Clear the cache of one or more indices. For data streams, the API clears the caches of the stream's backing indices.

By default, the clear cache API clears all caches. To clear only specific caches, use the fielddata, query, or request parameters. To clear the cache only of specific fields, use the fields parameter.

Required authorization

  • Index privileges: manage

Parameters

path Path Parameters

Name Type
index required

Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

type TypesIndices = type TypesIndexName = string | type TypesIndexName = string[]

query Query Parameters

Name Type
index

Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

type TypesIndices = type TypesIndexName = string | type TypesIndexName = string[]
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.

boolean
expand_wildcards

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.

type TypesExpandWildcards = type TypesExpandWildcard = "all" | "open" | "closed" | "hidden" | "none" | type TypesExpandWildcard = "all" | "open" | "closed" | "hidden" | "none"[]
fielddata

If true, clears the fields cache. Use the fields parameter to clear the cache of specific fields only.

boolean
fields

Comma-separated list of field names used to limit the fielddata parameter.

type TypesFields = type TypesField = string | type TypesField = string[]
ignore_unavailable

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

boolean
query

If true, clears the query cache.

boolean
request

If true, clears the request cache.

boolean

Responses

200 application/json
interface TypesShardsOperationResponseBase {
_shards?: TypesShardStatistics
interface TypesShardStatistics {
failed: TypesUint;
successful: TypesUint;
total: TypesUint;
failures?: TypesShardFailure[];
skipped?: TypesUint;
}
;
}