Skip to content

Commit 0f20e45

Browse files
committed
Fix recurring doc test failures with the cat API. (elastic#21561)
This failure is due to the fact that we sort on store size, which is cached. So it might happen that the store size that is taken into account is not the right one, which makes the indices sorted in the wrong order. This changes the doc example to sort on the number of docs instead. Closes elastic#21062
1 parent 05019cf commit 0f20e45

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

docs/reference/cat/indices.asciidoc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ GET /_cat/indices/twi*?v&s=index
1010
--------------------------------------------------
1111
// CONSOLE
1212
// TEST[setup:huge_twitter]
13-
// TEST[s/^/POST _flush\n/]
1413
// TEST[s/^/PUT twitter2\n{"settings": {"number_of_replicas": 0}}\n/]
15-
// We flush very early here because the index's size is cached and we sort on
16-
// size below. So to get a realistic sort on size we need to flush here or else
17-
// the size is just whatever portion of the index is pushed out of memory
18-
// during test setup which isn't deterministic.
1914

2015
Might respond with:
2116

@@ -64,11 +59,11 @@ yellow open twitter u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0
6459
// TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
6560
// TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ/.+/ _cat]
6661

67-
What's my largest index by disk usage not including replicas?
62+
Which index has the largest number of documents?
6863

6964
[source,js]
7065
--------------------------------------------------
71-
GET /_cat/indices?v&s=store.size:desc
66+
GET /_cat/indices?v&s=docs.count:desc
7267
--------------------------------------------------
7368
// CONSOLE
7469
// TEST[continued]

0 commit comments

Comments
 (0)