[Docs] Add _cache/clear parameter examples
Add example for selectively clearing just the request, query or fielddata cache
and for selectively clearing the cache for specific fields.
Closes
@@ -12,12 +12,32 @@ POST /twitter/_cache/clear
// TEST[setup:twitter]
The API, by default, will clear all caches. Specific caches can be cleaned
-explicitly by setting `query`, `fielddata` or `request`.
+explicitly by setting the `query`, `fielddata` or `request` url parameter to `true`.
-All caches relating to a specific field(s) can also be cleared by
-specifying `fields` parameter with a comma delimited list of the
-relevant fields. Note that the provided names must refer to concrete
-fields -- objects and field aliases are not supported.
+[source,js]
+--------------------------------------------------
+POST /twitter/_cache/clear?query=true <1>
+POST /twitter/_cache/clear?request=true <2>
+POST /twitter/_cache/clear?fielddata=true <3>
+--------------------------------------------------
+// CONSOLE
+// TEST[continued]
+<1> Cleans only the query cache
+<2> Cleans only the request cache
+<3> Cleans only the fielddata cache
+
+In addition to this, all caches relating to a specific field can also be
+cleared by specifying `fields` url parameter with a comma delimited list of
+the fields that should be cleared. Note that the provided names must refer to
+concrete fields -- objects and field aliases are not supported.
+
+[source,js]
+--------------------------------------------------
+POST /twitter/_cache/clear?fields=foo,bar <1>
+--------------------------------------------------
+// CONSOLE
+// TEST[continued]
+<1> Clear the cache for the `foo` an `bar` field
[float]
=== Multi Index
