Skip to content

Commit 37c514a

Browse files
committed
Add brief warning about timeout best-effort
1 parent f8a87b0 commit 37c514a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

060_Distributed_Search/15_Search_options.asciidoc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the _bouncing results_ problem.((("bouncing results problem")))
1818
.Bouncing Results
1919
****
2020
21-
Imagine that you are sorting your results by a `timestamp` field, and
21+
Imagine that you are sorting your results by a `timestamp` field, and
2222
two documents have the same timestamp. Because search requests are
2323
round-robined between all available shard copies, these two documents may be
2424
returned in one order when the request is served by the primary, and in
@@ -58,6 +58,22 @@ partial response with the `timed_out` property:
5858
--------------------------------------------------
5959
<1> The search request timed out.
6060

61+
[WARNING]
62+
====
63+
It's important to know that the timeout is still a best-effort operation; it's
64+
possible for the query to surpass the allotted timeout. There are two reasons for
65+
this behavior:
66+
67+
1. Timeout checks are performed on a per-document basis. However, some query types
68+
have a significant amount of work that must be performed *before* documents are evaluated.
69+
This "setup" phase does not consult the timeout, and so very long setup times can cause
70+
the overall latency to shoot past the timeout.
71+
2. Because the time is once per document, a very long query can execute on a single
72+
document and it won't timeout until the next document is evaluated. This also means
73+
poorly written scripts (e.g. ones with infinite loops) will be allowed to execute
74+
forever.
75+
====
76+
6177
[[search-routing]]
6278
==== routing
6379

@@ -79,7 +95,7 @@ discuss it in detail in <<scale>>.
7995
==== search_type
8096

8197
The default search type is `query_then_fetch` ((("query_then_fetch search type")))((("search options", "search_type")))((("search_type"))). In some cases, you might want to explicitly set the `search_type`
82-
to `dfs_query_then_fetch` to improve the accuracy of relevance scoring:
98+
to `dfs_query_then_fetch` to improve the accuracy of relevance scoring:
8399

84100
[source,js]
85101
--------------------------------------------------

0 commit comments

Comments
 (0)