// Path: src/main/java/org/elasticsearch/plugin/TokenPlugin.java
// public class TokenPlugin extends Plugin implements ScriptPlugin, ActionPlugin, SearchPlugin, IngestPlugin {
// 
//     private final Settings settings;
//     private final boolean transportClientMode;
//     private final IngestAnalysisService ingestAnalysisService;
// 
//     public TokenPlugin(Settings settings) {
//         this.settings = settings;
//         this.transportClientMode = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
//         ingestAnalysisService = new IngestAnalysisService(settings);
//     }
// 
//     @Override
//     public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
//                                                ResourceWatcherService resourceWatcherService, ScriptService scriptService,
//                                                SearchRequestParsers searchRequestParsers) {
//         ModelTrainers modelTrainers = new ModelTrainers(Arrays.asList(new NaiveBayesModelTrainer()));
//         TrainingService trainingService = new TrainingService(settings, clusterService, client, modelTrainers, searchRequestParsers);
// 
//         final ClusterSettings clusterSettings = clusterService.getClusterSettings();
//         Setting<Settings> ingestAnalysisGroupSetting = ingestAnalysisService.getIngestAnalysisGroupSetting();
//         clusterSettings.addSettingsUpdateConsumer(ingestAnalysisGroupSetting, ingestAnalysisService::setAnalysisSettings);
//         ingestAnalysisService.setAnalysisSettings(ingestAnalysisGroupSetting.get(settings));
// 
//         return Arrays.asList(trainingService, ingestAnalysisService);
//     }
// 
//     @Override
//     public ScriptEngineService getScriptEngineService(Settings settings) {
//         return new PMMLModelScriptEngineService(settings);
//     }
// 
//     @Override
//     public List<NativeScriptFactory> getNativeScripts() {
//         return Collections.singletonList(new VectorScriptFactory());
//     }
// 
//     @Override
//     public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
//         return Arrays.asList(
//                 new ActionHandler<>(AllTermsAction.INSTANCE, TransportAllTermsAction.class, TransportAllTermsShardAction.class),
//                 new ActionHandler<>(PrepareSpecAction.INSTANCE, TransportPrepareSpecAction.class),
//                 new ActionHandler<>(TrainModelAction.INSTANCE, TransportTrainModelAction.class)
//         );
//     }
// 
//     @Override
//     public List<Class<? extends RestHandler>> getRestHandlers() {
//         return Arrays.asList(
//                 RestAllTermsAction.class,
//                 RestPrepareSpecAction.class,
//                 RestStoreModelAction.class,
//                 RestTrainModelAction.class
//         );
//     }
// 
//     @Override
//     public List<FetchSubPhase> getFetchSubPhases(FetchPhaseConstructionContext context) {
//         return Arrays.asList(
//                 new TermVectorsFetchSubPhase(),
//                 new AnalyzedTextFetchSubPhase()
//         );
//     }
// 
//     @Override
//     public Map<String, Processor.Factory> getProcessors(Processor.Parameters parameters) {
//         ingestAnalysisService.setAnalysisRegistry(parameters.analysisRegistry);
//         return Collections.singletonMap(AnalyzerProcessor.TYPE, new AnalyzerProcessor.Factory(ingestAnalysisService));
//     }
// 
//     @Override
//     public List<Setting<?>> getSettings() {
//         return Collections.singletonList(ingestAnalysisService.getIngestAnalysisGroupSetting());
//     }
// 
//     @Override
//     public List<SearchExtSpec<?>> getSearchExts() {
//         return Arrays.asList(
//                 new SearchExtSpec<>(TermVectorsFetchSubPhase.NAME, TermVectorsFetchBuilder::new, TermVectorsFetchParser.INSTANCE),
//                 new SearchExtSpec<>(AnalyzedTextFetchSubPhase.NAME, AnalyzedTextFetchBuilder::new, AnalyzedTextFetchParser.INSTANCE)
//                 );
//     }
// }


import java.util.List;
import static org.elasticsearch.client.Requests.indexRequest;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.plugin.TokenPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHitField;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.test.ESIntegTestCase;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.elasticsearch.search.fetch.analyzedtext;





public class AnalyzedTextFetchIT extends ESIntegTestCase {

    protected Collection<Class<? extends Plugin>> transportClientPlugins() {
// Path: src/main/java/org/elasticsearch/plugin/TokenPlugin.java
// public class TokenPlugin extends Plugin implements ScriptPlugin, ActionPlugin, SearchPlugin, IngestPlugin {
// 
//     private final Settings settings;
//     private final boolean transportClientMode;
//     private final IngestAnalysisService ingestAnalysisService;
// 
//     public TokenPlugin(Settings settings) {
//         this.settings = settings;
//         this.transportClientMode = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
//         ingestAnalysisService = new IngestAnalysisService(settings);
//     }
// 
//     @Override
//     public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
//                                                ResourceWatcherService resourceWatcherService, ScriptService scriptService,
//                                                SearchRequestParsers searchRequestParsers) {
//         ModelTrainers modelTrainers = new ModelTrainers(Arrays.asList(new NaiveBayesModelTrainer()));
//         TrainingService trainingService = new TrainingService(settings, clusterService, client, modelTrainers, searchRequestParsers);
// 
//         final ClusterSettings clusterSettings = clusterService.getClusterSettings();
//         Setting<Settings> ingestAnalysisGroupSetting = ingestAnalysisService.getIngestAnalysisGroupSetting();
//         clusterSettings.addSettingsUpdateConsumer(ingestAnalysisGroupSetting, ingestAnalysisService::setAnalysisSettings);
//         ingestAnalysisService.setAnalysisSettings(ingestAnalysisGroupSetting.get(settings));
// 
//         return Arrays.asList(trainingService, ingestAnalysisService);
//     }
// 
//     @Override
//     public ScriptEngineService getScriptEngineService(Settings settings) {
//         return new PMMLModelScriptEngineService(settings);
//     }
// 
//     @Override
//     public List<NativeScriptFactory> getNativeScripts() {
//         return Collections.singletonList(new VectorScriptFactory());
//     }
// 
//     @Override
//     public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
//         return Arrays.asList(
//                 new ActionHandler<>(AllTermsAction.INSTANCE, TransportAllTermsAction.class, TransportAllTermsShardAction.class),
//                 new ActionHandler<>(PrepareSpecAction.INSTANCE, TransportPrepareSpecAction.class),
//                 new ActionHandler<>(TrainModelAction.INSTANCE, TransportTrainModelAction.class)
//         );
//     }
// 
//     @Override
//     public List<Class<? extends RestHandler>> getRestHandlers() {
//         return Arrays.asList(
//                 RestAllTermsAction.class,
//                 RestPrepareSpecAction.class,
//                 RestStoreModelAction.class,
//                 RestTrainModelAction.class
//         );
//     }
// 
//     @Override
//     public List<FetchSubPhase> getFetchSubPhases(FetchPhaseConstructionContext context) {
//         return Arrays.asList(
//                 new TermVectorsFetchSubPhase(),
//                 new AnalyzedTextFetchSubPhase()
//         );
//     }
// 
//     @Override
//     public Map<String, Processor.Factory> getProcessors(Processor.Parameters parameters) {
//         ingestAnalysisService.setAnalysisRegistry(parameters.analysisRegistry);
//         return Collections.singletonMap(AnalyzerProcessor.TYPE, new AnalyzerProcessor.Factory(ingestAnalysisService));
//     }
// 
//     @Override
//     public List<Setting<?>> getSettings() {
//         return Collections.singletonList(ingestAnalysisService.getIngestAnalysisGroupSetting());
//     }
// 
//     @Override
//     public List<SearchExtSpec<?>> getSearchExts() {
//         return Arrays.asList(
//                 new SearchExtSpec<>(TermVectorsFetchSubPhase.NAME, TermVectorsFetchBuilder::new, TermVectorsFetchParser.INSTANCE),
//                 new SearchExtSpec<>(AnalyzedTextFetchSubPhase.NAME, AnalyzedTextFetchBuilder::new, AnalyzedTextFetchParser.INSTANCE)
//                 );
//     }
// }


// Path: src/test/java/org/elasticsearch/search/fetch/analyzedtext/AnalyzedTextFetchIT.java
import java.util.List;
import static org.elasticsearch.client.Requests.indexRequest;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.plugin.TokenPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHitField;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.test.ESIntegTestCase;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.elasticsearch.search.fetch.analyzedtext;





public class AnalyzedTextFetchIT extends ESIntegTestCase {

    protected Collection<Class<? extends Plugin>> transportClientPlugins() {
        return Collections.singletonList(TokenPlugin.class);