Skip to content

Commit 8766b53

Browse files
committed
[DOCS] Deterministic scripted queries are cached
Refs: elastic#49321
1 parent 3b8f5d9 commit 8766b53

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/reference/modules/indices/request_cache.asciidoc

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ but it will cache `hits.total`, <<search-aggregations,aggregations>>, and
2121
<<search-suggesters,suggestions>>.
2222
2323
Most queries that use `now` (see <<date-math>>) cannot be cached.
24+
25+
Scripted queries that use the API calls which are non-deterministic, such as
26+
`Math.random()` or `new Date()` are not cached.
2427
===================================
2528

2629
[float]
@@ -95,10 +98,6 @@ GET /my_index/_search?request_cache=true
9598
-----------------------------
9699
// TEST[continued]
97100

98-
IMPORTANT: If your query uses a script whose result is not deterministic (e.g.
99-
it uses a random function or references the current time) you should set the
100-
`request_cache` flag to `false` to disable caching for that request.
101-
102101
Requests where `size` is greater than 0 will not be cached even if the request cache is
103102
enabled in the index settings. To cache these requests you will need to use the
104103
query-string parameter detailed here.

0 commit comments

Comments
 (0)