[DOCS] Deterministic scripted queries are cached (#50408) (#50411)

**Backport**

Refs: #49321
This commit is contained in:
Stuart Tettemer 2019-12-19 16:30:34 -07:00 committed by GitHub
parent f212994c16
commit 2e76865290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -21,6 +21,9 @@ but it will cache `hits.total`, <<search-aggregations,aggregations>>, and
<<search-suggesters,suggestions>>.
Most queries that use `now` (see <<date-math>>) cannot be cached.
Scripted queries that use the API calls which are non-deterministic, such as
`Math.random()` or `new Date()` are not cached.
===================================
[float]
@ -95,10 +98,6 @@ GET /my_index/_search?request_cache=true
-----------------------------
// TEST[continued]
IMPORTANT: If your query uses a script whose result is not deterministic (e.g.
it uses a random function or references the current time) you should set the
`request_cache` flag to `false` to disable caching for that request.
Requests where `size` is greater than 0 will not be cached even if the request cache is
enabled in the index settings. To cache these requests you will need to use the
query-string parameter detailed here.