Move search ext section parsing to the coordinating node
Original commit: elastic/x-pack-elasticsearch@1ce38fcff9
This commit is contained in:
parent
592ca5ab7b
commit
5829d112d1
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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<ScriptQueryBuilder> 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<ScriptQueryBuilder> 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<MatchAllQueryBuilder> queryParser = MatchAllQueryBuilder::fromXContent;
|
||||
queryRegistry.register(queryParser, MatchAllQueryBuilder.NAME);
|
||||
SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null);
|
||||
SearchRequestParsers searchParsers = new SearchRequestParsers(queryRegistry, null, null, null);
|
||||
Map<String, TransformFactory> factories = new HashMap<>();
|
||||
factories.put(ScriptTransform.TYPE, new ScriptTransformFactory(settings, scriptService));
|
||||
factories.put(SearchTransform.TYPE, new SearchTransformFactory(settings, client, searchParsers, scriptService));
|
||||
|
|
Loading…
Reference in New Issue