[Test] #27342 Fix SearchRequests#testValidate

This commit is contained in:
Jim Ferenczi 2017-11-10 18:51:58 +01:00
parent 9f43d7329b
commit bec5d43228
1 changed files with 5 additions and 1 deletions

View File

@ -91,8 +91,10 @@ public class SearchRequestTests extends AbstractSearchTestCase {
assertNull(validationErrors); assertNull(validationErrors);
} }
{ {
// disabeling `track_total_hits` isn't valid in scroll context // disabling `track_total_hits` isn't valid in scroll context
SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder()); SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder());
// make sure we don't set the request cache for a scroll query
searchRequest.requestCache(false);
searchRequest.scroll(new TimeValue(1000)); searchRequest.scroll(new TimeValue(1000));
searchRequest.source().trackTotalHits(false); searchRequest.source().trackTotalHits(false);
ActionRequestValidationException validationErrors = searchRequest.validate(); ActionRequestValidationException validationErrors = searchRequest.validate();
@ -103,6 +105,8 @@ public class SearchRequestTests extends AbstractSearchTestCase {
{ {
// scroll and `from` isn't valid // scroll and `from` isn't valid
SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder()); SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder());
// make sure we don't set the request cache for a scroll query
searchRequest.requestCache(false);
searchRequest.scroll(new TimeValue(1000)); searchRequest.scroll(new TimeValue(1000));
searchRequest.source().from(10); searchRequest.source().from(10);
ActionRequestValidationException validationErrors = searchRequest.validate(); ActionRequestValidationException validationErrors = searchRequest.validate();