Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/reference/modules/indices/request_cache.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down