Adds new parameter to Clear Index Cache API (#4132)

* clearcacheAPI

Signed-off-by: Heather Halter <hdhalter@amazon.com>

* Update _api-reference/index-apis/clear-index-cache.md

Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
Signed-off-by: Heather Halter <HDHALTER@AMAZON.COM>

* Update _api-reference/index-apis/clear-index-cache.md

Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
Signed-off-by: Heather Halter <HDHALTER@AMAZON.COM>

* editsfromteam

Signed-off-by: Heather Halter <hdhalter@amazon.com>

* fixedtickmarks

Signed-off-by: Heather Halter <hdhalter@amazon.com>

* fixedheadings

Signed-off-by: Heather Halter <hdhalter@amazon.com>

* fixheadings

Signed-off-by: Heather Halter <hdhalter@amazon.com>

* add-or

Signed-off-by: Heather Halter <hdhalter@amazon.com>

---------

Signed-off-by: Heather Halter <hdhalter@amazon.com>
Signed-off-by: Heather Halter <HDHALTER@AMAZON.COM>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
This commit is contained in:
Heather Halter 2023-05-30 10:35:13 -07:00 committed by GitHub
parent 2a5864ed6b
commit ad2c6936c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 22 deletions

View File

@ -1,11 +1,11 @@
--- ---
layout: default layout: default
title: Clear Index or Data Stream Cache title: Clear cache
parent: Index APIs parent: Index APIs
nav_order: 10 nav_order: 10
--- ---
# Clear index or data stream cache # Clear cache
The clear cache API operation clears the caches of one or more indexes. For data streams, the API clears the caches of the streams backing indexes. The clear cache API operation clears the caches of one or more indexes. For data streams, the API clears the caches of the streams backing indexes.
@ -17,7 +17,7 @@ If you use the Security plugin, you must have the `manage index` privileges.
| Parameter | Data type | Description | | Parameter | Data type | Description |
:--- | :--- | :--- :--- | :--- | :---
| target | String | Comma-delimited list of data streams, indexes, and index aliases to which cache clearing will be applied. Wildcard expressions (`*`) are supported. To target all data streams and indexes in a cluster, omit this parameter or use `_all` or `*`. Optional. | | target | String | Comma-delimited list of data streams, indexes, and index aliases to which cache clearing is applied. Wildcard expressions (`*`) are supported. To target all data streams and indexes in a cluster, omit this parameter or use `_all` or `*`. Optional. |
## Query parameters ## Query parameters
@ -29,8 +29,9 @@ All query parameters are optional.
| allow_no_indices | Boolean | Whether to ignore wildcards, index aliases, or `_all` target (`target` path parameter) values that dont match any indexes. If `false`, the request returns an error if any wildcard expression, index alias, or `_all` target value doesn't match any indexes. This behavior also applies if the request targets include other open indexes. For example, a request where the target is `fig*,app*` returns an error if an index starts with `fig` but no index starts with `app`. Defaults to `true`. | | allow_no_indices | Boolean | Whether to ignore wildcards, index aliases, or `_all` target (`target` path parameter) values that dont match any indexes. If `false`, the request returns an error if any wildcard expression, index alias, or `_all` target value doesn't match any indexes. This behavior also applies if the request targets include other open indexes. For example, a request where the target is `fig*,app*` returns an error if an index starts with `fig` but no index starts with `app`. Defaults to `true`. |
| expand_wildcards | String | Determines the index types that wildcard expressions can expand to. Accepts multiple values separated by a comma, such as `open,hidden`. Valid values are: <br /><br /> `all` -- Expand to open, closed, and hidden indexes.<br /><br />`open` -- Expand only to open indexes.<br /><br />`closed` -- Expand only to closed indexes<br /><br />`hidden` -- Expand to include hidden indexes. Must be combined with `open`, `closed`, or `both`.<br /><br />`none` -- Expansions are not accepted.<br /><br /> Defaults to `open`. | | expand_wildcards | String | Determines the index types that wildcard expressions can expand to. Accepts multiple values separated by a comma, such as `open,hidden`. Valid values are: <br /><br /> `all` -- Expand to open, closed, and hidden indexes.<br /><br />`open` -- Expand only to open indexes.<br /><br />`closed` -- Expand only to closed indexes<br /><br />`hidden` -- Expand to include hidden indexes. Must be combined with `open`, `closed`, or `both`.<br /><br />`none` -- Expansions are not accepted.<br /><br /> Defaults to `open`. |
| fielddata | Boolean | If `true`, clears the fields cache. Use the `fields` parameter to clear specific fields' caches. Defaults to `true`. | | fielddata | Boolean | If `true`, clears the fields cache. Use the `fields` parameter to clear specific fields' caches. Defaults to `true`. |
| fields | String | Used in conjunction with the `fielddata` parameter. Comma-delimited list of field names that will be cleared out of the cache. Does not support objects or field aliases. Defaults to all fields. | | fields | String | Used in conjunction with the `fielddata` parameter. Comma-delimited list of field names that are cleared out of the cache. Does not support objects or field aliases. Defaults to all fields. |
| index | String | Comma-delimited list of index names that will be cleared out of the cache. | | file | Boolean | If `true`, clears the unused entries from the file cache on nodes with the Search role. Defaults to `false`. |
| index | String | Comma-delimited list of index names that are cleared out of the cache. |
| ignore_unavailable | Boolean | If `true`, OpenSearch ignores missing or closed indexes. Defaults to `false`. | | ignore_unavailable | Boolean | If `true`, OpenSearch ignores missing or closed indexes. Defaults to `false`. |
| query | Boolean | If `true`, clears the query cache. Defaults to `true`. | | query | Boolean | If `true`, clears the query cache. Defaults to `true`. |
| request | Boolean | If `true`, clears the request cache. Defaults to `true`. | | request | Boolean | If `true`, clears the request cache. Defaults to `true`. |
@ -43,61 +44,68 @@ The following example requests show multiple clear cache API uses.
The following request clears the fields cache only: The following request clears the fields cache only:
````json ```json
POST /my-index/_cache/clear?fielddata=true POST /my-index/_cache/clear?fielddata=true
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
<hr /> <hr />
The following request clears the query cache only: The following request clears the query cache only:
````json ```json
POST /my-index/_cache/clear?query=true POST /my-index/_cache/clear?query=true
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
<hr /> <hr />
The following request clears the request cache only: The following request clears the request cache only:
````json ```json
POST /my-index/_cache/clear?request=true POST /my-index/_cache/clear?request=true
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
### Clear the cache for specific fields ### Clear the cache for specific fields
The following request clears the fields caches of `fielda` and `fieldb`: The following request clears the fields caches of `fielda` and `fieldb`:
````json ```json
POST /my-index/_cache/clear?fields=fielda,fieldb POST /my-index/_cache/clear?fields=fielda,fieldb
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
### Clear caches for specific data streams and indexes ### Clear caches for specific data streams or indexes
The following request clears the cache for two specific indexes: The following request clears the cache for two specific indexes:
````json ```json
POST /my-index,my-index2/_cache/clear POST /my-index,my-index2/_cache/clear
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
### Clear caches for all data streams and indexes ### Clear caches for all data streams and indexes
The following request clears the cache for all data streams and indexes: The following request clears the cache for all data streams and indexes:
````json ```json
POST /_cache/clear POST /_cache/clear
```` ```
{% include copy-curl.html %} {% include copy-curl.html %}
## Example response ### Clear unused entries from the cache on search-capable nodes
```json
POST /*/_cache/clear?file=true
```
{% include copy-curl.html %}
#### Example response
The `POST /books,hockey/_cache/clear` request returns the following fields: The `POST /books,hockey/_cache/clear` request returns the following fields:
````json ```json
{ {
"_shards" : { "_shards" : {
"total" : 4, "total" : 4,
@ -105,9 +113,9 @@ The `POST /books,hockey/_cache/clear` request returns the following fields:
"failed" : 0 "failed" : 0
} }
} }
```` ```
## Response fields #### Response fields
The `POST /books,hockey/_cache/clear` request returns the following response fields: The `POST /books,hockey/_cache/clear` request returns the following response fields: