|
41 | 41 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.clearScroll;
|
42 | 42 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.initialSearch;
|
43 | 43 | import static org.elasticsearch.index.reindex.remote.RemoteRequestBuilders.scroll;
|
| 44 | +import static org.hamcrest.Matchers.contains; |
44 | 45 | import static org.hamcrest.Matchers.containsString;
|
45 | 46 | import static org.hamcrest.Matchers.either;
|
46 | 47 | import static org.hamcrest.Matchers.empty;
|
@@ -206,6 +207,22 @@ public void testInitialSearchParamsMisc() {
|
206 | 207 | }
|
207 | 208 | }
|
208 | 209 |
|
| 210 | + public void testInitialSearchDisallowPartialResults() { |
| 211 | + final String allowPartialParamName = "allow_partial_search_results"; |
| 212 | + final int v6_3 = 6030099; |
| 213 | + |
| 214 | + BytesReference query = new BytesArray("{}"); |
| 215 | + SearchRequest searchRequest = new SearchRequest().source(new SearchSourceBuilder()); |
| 216 | + |
| 217 | + Version disallowVersion = Version.fromId(between(v6_3, Version.CURRENT.id)); |
| 218 | + Map<String, String> params = initialSearch(searchRequest, query, disallowVersion).getParameters(); |
| 219 | + assertEquals("false", params.get(allowPartialParamName)); |
| 220 | + |
| 221 | + Version allowVersion = Version.fromId(between(0, v6_3-1)); |
| 222 | + params = initialSearch(searchRequest, query, allowVersion).getParameters(); |
| 223 | + assertThat(params.keySet(), not(contains(allowPartialParamName))); |
| 224 | + } |
| 225 | + |
209 | 226 | private void assertScroll(Version remoteVersion, Map<String, String> params, TimeValue requested) {
|
210 | 227 | // V_5_0_0
|
211 | 228 | if (remoteVersion.before(Version.fromId(5000099))) {
|
|
0 commit comments