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);
|
searchRequestParsers.queryParsers, searchSourceParser, parseFieldMatcher);
|
||||||
try (XContentBuilder upgradeBuilder = XContentBuilder.builder(parser.contentType().xContent())) {
|
try (XContentBuilder upgradeBuilder = XContentBuilder.builder(parser.contentType().xContent())) {
|
||||||
SearchSourceBuilder sourceBuilder = SearchSourceBuilder.fromXContent(context,
|
SearchSourceBuilder sourceBuilder = SearchSourceBuilder.fromXContent(context,
|
||||||
searchRequestParsers.aggParsers, searchRequestParsers.suggesters);
|
searchRequestParsers.aggParsers, searchRequestParsers.suggesters,
|
||||||
|
searchRequestParsers.searchExtParsers);
|
||||||
upgradeBuilder.value(sourceBuilder);
|
upgradeBuilder.value(sourceBuilder);
|
||||||
searchSource = upgradeBuilder.bytes();
|
searchSource = upgradeBuilder.bytes();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class WatcherSearchTemplateService extends AbstractComponent {
|
||||||
if (source != null && source.length() > 0) {
|
if (source != null && source.length() > 0) {
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(source)) {
|
||||||
sourceBuilder.parseXContent(new QueryParseContext(searchRequestParsers.queryParsers, parser, parseFieldMatcher),
|
sourceBuilder.parseXContent(new QueryParseContext(searchRequestParsers.queryParsers, parser, parseFieldMatcher),
|
||||||
searchRequestParsers.aggParsers, searchRequestParsers.suggesters);
|
searchRequestParsers.aggParsers, searchRequestParsers.suggesters, searchRequestParsers.searchExtParsers);
|
||||||
searchRequest.source(sourceBuilder);
|
searchRequest.source(sourceBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class SearchInputTests extends ESIntegTestCase {
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
|
|
||||||
IndicesQueriesRegistry indicesQueryRegistry = internalCluster().getInstance(IndicesQueriesRegistry.class);
|
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()),
|
SearchInputFactory factory = new SearchInputFactory(Settings.EMPTY, WatcherClientProxy.of(client()),
|
||||||
searchParsers, scriptService());
|
searchParsers, scriptService());
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
||||||
import org.elasticsearch.license.XPackLicenseState;
|
import org.elasticsearch.license.XPackLicenseState;
|
||||||
import org.elasticsearch.script.Script;
|
import org.elasticsearch.script.Script;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
import org.elasticsearch.script.ScriptSettings;
|
|
||||||
import org.elasticsearch.search.SearchRequestParsers;
|
import org.elasticsearch.search.SearchRequestParsers;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.xpack.common.http.HttpClient;
|
import org.elasticsearch.xpack.common.http.HttpClient;
|
||||||
|
@ -305,7 +304,7 @@ public class WatchTests extends ESTestCase {
|
||||||
queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME);
|
queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME);
|
||||||
QueryParser<ScriptQueryBuilder> queryParser2 = ScriptQueryBuilder::fromXContent;
|
QueryParser<ScriptQueryBuilder> queryParser2 = ScriptQueryBuilder::fromXContent;
|
||||||
queryRegistry.register(queryParser2, ScriptQueryBuilder.NAME);
|
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);
|
WatcherSearchTemplateService searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, searchParsers);
|
||||||
|
|
||||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||||
|
@ -437,7 +436,7 @@ public class WatchTests extends ESTestCase {
|
||||||
queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME);
|
queryRegistry.register(queryParser1, MatchAllQueryBuilder.NAME);
|
||||||
QueryParser<ScriptQueryBuilder> queryParser2 = ScriptQueryBuilder::fromXContent;
|
QueryParser<ScriptQueryBuilder> queryParser2 = ScriptQueryBuilder::fromXContent;
|
||||||
queryRegistry.register(queryParser2, ScriptQueryBuilder.NAME);
|
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));
|
parsers.put(SearchInput.TYPE, new SearchInputFactory(settings, client, searchParsers, scriptService));
|
||||||
return new InputRegistry(Settings.EMPTY, parsers);
|
return new InputRegistry(Settings.EMPTY, parsers);
|
||||||
default:
|
default:
|
||||||
|
@ -502,7 +501,7 @@ public class WatchTests extends ESTestCase {
|
||||||
IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry();
|
IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry();
|
||||||
QueryParser<MatchAllQueryBuilder> queryParser = MatchAllQueryBuilder::fromXContent;
|
QueryParser<MatchAllQueryBuilder> queryParser = MatchAllQueryBuilder::fromXContent;
|
||||||
queryRegistry.register(queryParser, MatchAllQueryBuilder.NAME);
|
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<>();
|
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, scriptService));
|
factories.put(SearchTransform.TYPE, new SearchTransformFactory(settings, client, searchParsers, scriptService));
|
||||||
|
|
Loading…
Reference in New Issue