Skip to content

Commit 88d0320

Browse files
committed
Add indices options tests to search api REST tests (#21701)
This is a followup to #21689 where we removed a misplaced try catch for IndexMissingException and IndexClosedException which was related to #9047 (at least for the index closed case). The code block within the change was moved as part of #20890, which made the catch redundant. It was somehow used before (e.g. in 5.0) but it doesn't seem that this catch had any effect. Added tests to verify that. In fact a specific catch added to the search api only would defeat the purpose of having common indices options that work throughout all our APIs. Relates to #21689
1 parent 2d9a0c1 commit 88d0320

File tree

2 files changed

+63
-7
lines changed

2 files changed

+63
-7
lines changed

rest-api-spec/src/main/resources/rest-api-spec/test/search/80_date_math_index_names.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
"Missing index date math with catch":
3+
4+
- do:
5+
catch: /logstash-\d{4}\.\d{2}\.\d{2}/
6+
search:
7+
index: <logstash-{now/M}>
8+
9+
---
10+
"Missing index":
11+
12+
- do:
13+
catch: missing
14+
search:
15+
index: missing_index
16+
17+
- do:
18+
search:
19+
index: missing_index
20+
ignore_unavailable: true
21+
22+
- match: {hits.total: 0}
23+
24+
---
25+
"Closed index":
26+
27+
- do:
28+
indices.create:
29+
index: index_closed
30+
31+
- do:
32+
indices.close:
33+
index: index_closed
34+
35+
- do:
36+
catch: /index_closed_exception/
37+
search:
38+
index: index_closed
39+
40+
- do:
41+
search:
42+
index: index_closed
43+
ignore_unavailable: true
44+
45+
- match: {hits.total: 0}
46+
47+
- do:
48+
search:
49+
index: index*
50+
51+
- match: {hits.total: 0}
52+
53+
- do:
54+
catch: missing
55+
search:
56+
index: index*
57+
allow_no_indices: false
58+
59+
- do:
60+
catch: /index_closed_exception/
61+
search:
62+
index: index*
63+
expand_wildcards: ["open","closed"]

0 commit comments

Comments
 (0)