|
40 | 40 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.clearScroll;
|
41 | 41 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.initialSearch;
|
42 | 42 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.scroll;
|
| 43 | +import static org.hamcrest.Matchers.contains; |
43 | 44 | import static org.hamcrest.Matchers.containsString;
|
44 | 45 | import static org.hamcrest.Matchers.either;
|
45 | 46 | import static org.hamcrest.Matchers.empty;
|
@@ -178,6 +179,22 @@ public void testInitialSearchParamsMisc() {
|
178 | 179 | }
|
179 | 180 | }
|
180 | 181 |
|
| 182 | + public void testInitialSearchDisallowPartialResults() { |
| 183 | + final String allowPartialParamName = "allow_partial_search_results"; |
| 184 | + final int v6_3 = 6030099; |
| 185 | + |
| 186 | + BytesReference query = new BytesArray("{}"); |
| 187 | + SearchRequest searchRequest = new SearchRequest().source(new SearchSourceBuilder()); |
| 188 | + |
| 189 | + Version disallowVersion = Version.fromId(between(v6_3, Version.CURRENT.id)); |
| 190 | + Map<String, String> params = initialSearch(searchRequest, query, disallowVersion).getParameters(); |
| 191 | + assertEquals("false", params.get(allowPartialParamName)); |
| 192 | + |
| 193 | + Version allowVersion = Version.fromId(between(0, v6_3-1)); |
| 194 | + params = initialSearch(searchRequest, query, allowVersion).getParameters(); |
| 195 | + assertThat(params.keySet(), not(contains(allowPartialParamName))); |
| 196 | + } |
| 197 | + |
181 | 198 | private void assertScroll(Version remoteVersion, Map<String, String> params, TimeValue requested) {
|
182 | 199 | // V_5_0_0
|
183 | 200 | if (remoteVersion.before(Version.fromId(5000099))) {
|
|
0 commit comments