Handle core replacing Suggesters with namedObject

Original commit: elastic/x-pack-elasticsearch@e68d82569f
This commit is contained in:
Nik Everett 2017-01-09 15:54:55 -05:00
parent e0f0b4b7b8
commit 66a2f0d49e
3 changed files with 5 additions and 6 deletions

View File

@ -74,8 +74,7 @@ public class WatcherSearchTemplateService extends AbstractComponent {
BytesReference source = request.getSearchSource(); BytesReference source = request.getSearchSource();
if (source != null && source.length() > 0) { if (source != null && source.length() > 0) {
try (XContentParser parser = XContentFactory.xContent(source).createParser(xContentRegistry, source)) { try (XContentParser parser = XContentFactory.xContent(source).createParser(xContentRegistry, source)) {
sourceBuilder.parseXContent(new QueryParseContext(parser, parseFieldMatcher), sourceBuilder.parseXContent(new QueryParseContext(parser, parseFieldMatcher));
searchRequestParsers.suggesters);
searchRequest.source(sourceBuilder); searchRequest.source(sourceBuilder);
} }
} }

View File

@ -144,7 +144,7 @@ public class SearchInputTests extends ESIntegTestCase {
XContentParser parser = createParser(builder); XContentParser parser = createParser(builder);
parser.nextToken(); parser.nextToken();
SearchRequestParsers searchParsers = new SearchRequestParsers(null); SearchRequestParsers searchParsers = new SearchRequestParsers();
SearchInputFactory factory = new SearchInputFactory(Settings.EMPTY, WatcherClientProxy.of(client()), SearchInputFactory factory = new SearchInputFactory(Settings.EMPTY, WatcherClientProxy.of(client()),
searchParsers, xContentRegistry(), scriptService()); searchParsers, xContentRegistry(), scriptService());

View File

@ -288,7 +288,7 @@ public class WatchTests extends ESTestCase {
ActionRegistry actionRegistry = registry(Collections.emptyList(), conditionRegistry, transformRegistry); ActionRegistry actionRegistry = registry(Collections.emptyList(), conditionRegistry, transformRegistry);
Watch.Parser watchParser = new Watch.Parser(settings, triggerService, actionRegistry, inputRegistry, null, Clock.systemUTC()); Watch.Parser watchParser = new Watch.Parser(settings, triggerService, actionRegistry, inputRegistry, null, Clock.systemUTC());
SearchRequestParsers searchParsers = new SearchRequestParsers(null); SearchRequestParsers searchParsers = new SearchRequestParsers();
WatcherSearchTemplateService searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, searchParsers, WatcherSearchTemplateService searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, searchParsers,
xContentRegistry()); xContentRegistry());
@ -409,7 +409,7 @@ public class WatchTests extends ESTestCase {
Map<String, InputFactory> parsers = new HashMap<>(); Map<String, InputFactory> parsers = new HashMap<>();
switch (inputType) { switch (inputType) {
case SearchInput.TYPE: case SearchInput.TYPE:
SearchRequestParsers searchParsers = new SearchRequestParsers(null); SearchRequestParsers searchParsers = new SearchRequestParsers();
parsers.put(SearchInput.TYPE, new SearchInputFactory(settings, client, searchParsers, xContentRegistry(), scriptService)); parsers.put(SearchInput.TYPE, new SearchInputFactory(settings, client, searchParsers, xContentRegistry(), scriptService));
return new InputRegistry(Settings.EMPTY, parsers); return new InputRegistry(Settings.EMPTY, parsers);
default: default:
@ -457,7 +457,7 @@ public class WatchTests extends ESTestCase {
} }
private TransformRegistry transformRegistry() { private TransformRegistry transformRegistry() {
SearchRequestParsers searchParsers = new SearchRequestParsers(null); SearchRequestParsers searchParsers = new SearchRequestParsers();
Map<String, TransformFactory> factories = new HashMap<>(); Map<String, TransformFactory> factories = new HashMap<>();
factories.put(ScriptTransform.TYPE, new ScriptTransformFactory(settings, scriptService)); factories.put(ScriptTransform.TYPE, new ScriptTransformFactory(settings, scriptService));
factories.put(SearchTransform.TYPE, new SearchTransformFactory(settings, client, searchParsers, xContentRegistry(), scriptService)); factories.put(SearchTransform.TYPE, new SearchTransformFactory(settings, client, searchParsers, xContentRegistry(), scriptService));