Skip to content

elasticsearch clear-cache

Clear the caches of one or more indices

Description

Clear the caches of one or more indices

Synopsis

elasticsearch clear-cache
    [--site <site>]
    [--cluster <cluster>]
    [--target <target>]
    [--fielddata]
    [--fields <fields>]
    [--query]
    [--request]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of elastic search cluster
     Example: --cluster "elastic-default"
     Default: elastic-default      Attributes: optional

target - (string)

     List of data streams, indices, and index aliases used to limit the request
     Example: --target "students or _all"
     Default: _all      Attributes: optional, multiple allowed

fielddata - (bool)

     If set, clears the cache. If fields argument is specified, cache is cleared for specified fields only
     Example: --fielddata
     Default: _None_      Attributes: optional

fields - (string)

     List of field names used to limit the fielddata parameter. Defaults to all fields.
     Example: --fields "foo"
     Default: _None_      Attributes: optional, multiple allowed

query - (bool)

     If set, clears the query cache
     Example: --query
     Default: _None_      Attributes: optional

request - (bool)

     If set, clears the request cache
     Example: --request
     Default: _None_      Attributes: optional

Examples

Input:

! elasticsearch clear-cache --cluster "elastic-1" --fielddata --target "class"
Output:
{
  "_shards": {
    "total": 4,
    "successful": 2,
    "failed": 0
  }
}

Access Control

To use this command, you need access to the following:

Field Value
Action "update"
Service Type "elasticsearch"
Service Instance cluster
Namespace
Object Type "index"
Object ID target

Please see Access Control for details.