From b6c714ccc8a2f670de2c0d7cd872335a4c5410c0 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Tue, 9 May 2017 18:51:49 +0200 Subject: [PATCH] Fix BWC for query_and_fetch --- .../org/elasticsearch/action/search/TransportSearchAction.java | 1 + .../test/java/org/elasticsearch/search/SearchRequestTests.java | 3 ++- .../org/elasticsearch/search/RandomSearchRequestGenerator.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java b/core/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java index f65597a966b..720fb17ae94 100644 --- a/core/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java +++ b/core/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java @@ -342,6 +342,7 @@ public class TransportSearchAction extends HandledTransportAction mutation.requestCache((randomValueOtherThan(searchRequest.requestCache(), () -> randomBoolean())))); mutators.add(() -> mutation .scroll(randomValueOtherThan(searchRequest.scroll(), () -> new Scroll(new TimeValue(randomNonNegativeLong() % 100000))))); - mutators.add(() -> mutation.searchType(randomValueOtherThan(searchRequest.searchType(), () -> randomFrom(SearchType.values())))); + mutators.add(() -> mutation.searchType(randomValueOtherThan(searchRequest.searchType(), + () -> randomFrom(SearchType.DFS_QUERY_THEN_FETCH, SearchType.QUERY_THEN_FETCH)))); mutators.add(() -> mutation.source(randomValueOtherThan(searchRequest.source(), this::createSearchSourceBuilder))); randomFrom(mutators).run(); return mutation; diff --git a/test/framework/src/main/java/org/elasticsearch/search/RandomSearchRequestGenerator.java b/test/framework/src/main/java/org/elasticsearch/search/RandomSearchRequestGenerator.java index 18448b5829c..4cd46fe5076 100644 --- a/test/framework/src/main/java/org/elasticsearch/search/RandomSearchRequestGenerator.java +++ b/test/framework/src/main/java/org/elasticsearch/search/RandomSearchRequestGenerator.java @@ -104,7 +104,7 @@ public class RandomSearchRequestGenerator { searchRequest.scroll(randomPositiveTimeValue()); } if (randomBoolean()) { - searchRequest.searchType(randomFrom(SearchType.values())); + searchRequest.searchType(randomFrom(SearchType.DFS_QUERY_THEN_FETCH, SearchType.QUERY_THEN_FETCH)); } if (randomBoolean()) { searchRequest.source(randomSearchSourceBuilder.get());