From 5829d112d12d764e5677e9ba008865d75223af84 Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 9 Sep 2016 18:05:04 +0200 Subject: [PATCH] Move search ext section parsing to the coordinating node Original commit: elastic/x-pack-elasticsearch@1ce38fcff9e2387efe81f9a6b118f99b1432e81d --- .../support/search/WatcherSearchTemplateRequest.java | 3 ++- .../support/search/WatcherSearchTemplateService.java | 2 +- .../xpack/watcher/test/integration/SearchInputTests.java | 2 +- .../org/elasticsearch/xpack/watcher/watch/WatchTests.java | 7 +++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java index 4f906ce3f66..998e027e203 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java @@ -215,7 +215,8 @@ public class WatcherSearchTemplateRequest implements ToXContent { searchRequestParsers.queryParsers, searchSourceParser, parseFieldMatcher); try (XContentBuilder upgradeBuilder = XContentBuilder.builder(parser.contentType().xContent())) { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.fromXContent(context, - searchRequestParsers.aggParsers, searchRequestParsers.suggesters); + searchRequestParsers.aggParsers, searchRequestParsers.suggesters, + searchRequestParsers.searchExtParsers); upgradeBuilder.value(sourceBuilder); searchSource = upgradeBuilder.bytes(); } catch (Exception e) { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java index 224a948bebc..9af4692328b 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java @@ -73,7 +73,7 @@ public class WatcherSearchTemplateService extends AbstractComponent { if (source != null && source.length() > 0) { try (XContentParser parser = XContentFactory.xContent(source).createParser(source)) { sourceBuilder.parseXContent(new QueryParseContext(searchRequestParsers.queryParsers, parser, parseFieldMatcher), - searchRequestParsers.aggParsers, searchRequestParsers.suggesters); + searchRequestParsers.aggParsers, searchRequestParsers.suggesters, searchRequestParsers.searchExtParsers); searchRequest.source(sourceBuilder); } } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchInputTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchInputTests.java index 46c689240b7..ade75ead221 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchInputTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchInputTests.java @@ -147,7 +147,7 @@ public class SearchInputTests extends ESIntegTestCase { parser.nextToken(); IndicesQueriesRegistry indicesQueryRegistry = internalCluster().getInstance(IndicesQueriesRegistry.class); - SearchRequestParsers searchParsers = new SearchRequestParsers(indicesQueryRegistry, null, null); + SearchRequestParsers searchParsers = new SearchRequestParsers(indicesQueryRegistry, null, null, null); SearchInputFactory factory = new SearchInputFactory(Settings.EMPTY, WatcherClientProxy.of(client()), searchParsers, scriptService()); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java index 11106d22a04..6a95bc9b246 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java @@ -21,7 +21,6 @@ import org.elasticsearch.indices.query.IndicesQueriesRegistry; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptService; -import org.elasticsearch.script.ScriptSettings; import org.elasticsearch.search.SearchRequestParsers; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.common.http.HttpClient; @@ -305,7 +304,7 @@ public class WatchTests extends ESTestCase { queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME); QueryParser queryParser2 = ScriptQueryBuilder::fromXContent; queryRegistry.register(queryParser2, ScriptQueryBuilder.NAME); - SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null); + SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null, null); WatcherSearchTemplateService searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, searchParsers); XContentBuilder builder = XContentFactory.jsonBuilder(); @@ -437,7 +436,7 @@ public class WatchTests extends ESTestCase { queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME); QueryParser queryParser2 = ScriptQueryBuilder::fromXContent; queryRegistry.register(queryParser2, ScriptQueryBuilder.NAME); - SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null); + SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null, null); parsers.put(SearchInput.TYPE, new SearchInputFactory(settings, client, searchParsers, scriptService)); return new InputRegistry(Settings.EMPTY, parsers); default: @@ -502,7 +501,7 @@ public class WatchTests extends ESTestCase { IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry(); QueryParser queryParser = MatchAllQueryBuilder::fromXContent; queryRegistry.register(queryParser, MatchAllQueryBuilder.NAME); - SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null); + SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null, null); Map factories = new HashMap<>(); factories.put(ScriptTransform.TYPE, new ScriptTransformFactory(settings, scriptService)); factories.put(SearchTransform.TYPE, new SearchTransformFactory(settings, client, searchParsers, scriptService));