org.elasticsearch.rest.RestHandler Java Examples

The following examples show how to use org.elasticsearch.rest.RestHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BundlePlugin.java    From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
                                         RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> extra = new ArrayList<>();
    if (settings.getAsBoolean("plugins.xbib.isbnformat.enabled", true)) {
        extra.add(new RestISBNFormatterAction(settings, restController));
    }
    if (settings.getAsBoolean("plugins.xbib.langdetect.enabled", true)) {
        extra.add(new RestLangdetectAction(settings, restController));
    }
    return extra;
}
 
Example #2
Source File: ZentityPlugin.java    From zentity with Apache License 2.0 6 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(
        Settings settings,
        RestController restController,
        ClusterSettings clusterSettings,
        IndexScopedSettings indexScopedSettings,
        SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver,
        Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> handlers = new ArrayList<RestHandler>() {{
        new HomeAction(restController);
        new ModelsAction(restController);
        new ResolutionAction(restController);
        new SetupAction(restController);
    }};
    return handlers;
}
 
Example #3
Source File: RestSimpleFeatureStore.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
public static void register(List<RestHandler> list, RestController restController) {
    for (String type : SUPPORTED_TYPES) {
        list.add(new RestAddOrUpdateFeature(type));
        list.add(new RestSearchStoreElements(type));
    }
    list.add(new RestStoreManager());
}
 
Example #4
Source File: ClusteringPlugin.java    From elasticsearch-carrot2 with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
   return Arrays.asList(
       new ClusteringAction.RestClusteringAction(restController),
       new ListAlgorithmsAction.RestListAlgorithmsAction(restController));
}
 
Example #5
Source File: DataFormatPlugin.java    From elasticsearch-dataformat with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(final Settings settings,
        final RestController restController, final ClusterSettings clusterSettings,
        final IndexScopedSettings indexScopedSettings,
        final SettingsFilter settingsFilter,
        final IndexNameExpressionResolver indexNameExpressionResolver,
        final Supplier<DiscoveryNodes> nodesInCluster) {
    return Arrays.asList(new RestDataAction(settings, restController));
}
 
Example #6
Source File: OpenShiftElasticSearchPlugin.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
        ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> list = new ArrayList<>();
    list.addAll(sgPlugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings,
            settingsFilter, indexNameExpressionResolver, nodesInCluster));
    return list;
}
 
Example #7
Source File: OpenDistroSecurityRestApiActions.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
public static Collection<RestHandler> getHandler(Settings settings, Path configPath, RestController controller, Client client,
        AdminDNs adminDns, ConfigurationRepository cr, ClusterService cs, PrincipalExtractor principalExtractor, 
        final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
    final List<RestHandler> handlers = new ArrayList<RestHandler>(9);
    handlers.add(new InternalUsersApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new RolesMappingApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new RolesApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new ActionGroupsApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new FlushCacheApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new OpenDistroSecurityConfigAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new PermissionsInfoAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new AuthTokenProcessorAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new TenantsApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    return Collections.unmodifiableCollection(handlers);
}
 
Example #8
Source File: LtrQueryParserPlugin.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
                                         ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    List<RestHandler> list = new ArrayList<>();
    RestSimpleFeatureStore.register(list, restController);
    list.add(new RestFeatureStoreCaches());
    list.add(new RestCreateModelFromSet());
    list.add(new RestAddFeatureToSet());
    return unmodifiableList(list);
}
 
Example #9
Source File: PrometheusExporterPlugin.java    From elasticsearch-prometheus-exporter with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    return singletonList(
            new RestPrometheusMetricsAction(settings, clusterSettings)
    );
}
 
Example #10
Source File: ElasticReportPlugin.java    From elasticsearch-report-engine with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
    RestController restController, ClusterSettings clusterSettings,
    IndexScopedSettings indexScopedSettings,
    SettingsFilter settingsFilter,
    IndexNameExpressionResolver indexNameExpressionResolver,
    Supplier<DiscoveryNodes> nodesInCluster) {
  return Arrays.asList(new ReportGenerateRestAction(settings, restController));
}
 
Example #11
Source File: OpenDistroSecuritySSLPlugin.java    From deprecated-security-ssl with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
        IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
        IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    
    final List<RestHandler> handlers = new ArrayList<RestHandler>(1);
    
    if (!client) {
        handlers.add(new OpenDistroSecuritySSLInfoAction(settings, configPath, restController, odsks, Objects.requireNonNull(principalExtractor)));
    }
    
    return handlers;
}
 
Example #12
Source File: AppendLucenePlugin.java    From ES-Fastloader with Apache License 2.0 5 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings,
                                         RestController restController,
                                         ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings,
                                         SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Supplier<DiscoveryNodes> nodesInCluster) {
    return Arrays.asList( new AppendLuceneRestHandler(settings, restController));
}
 
Example #13
Source File: OpenShiftElasticSearchPlugin.java    From openshift-elasticsearch-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public UnaryOperator<RestHandler> getRestHandlerWrapper(final ThreadContext threadContext) {
    return (rh) -> aclFilter.wrap(rh, sgPlugin.getRestHandlerWrapper(threadContext));
}
 
Example #14
Source File: SqlPlugin.java    From elasticsearch-sql with MIT License 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    return Collections.singletonList(new RestSqlAction());
}
 
Example #15
Source File: RangerSecurityRestFilter.java    From ranger with Apache License 2.0 4 votes vote down vote up
public RangerSecurityRestFilter(final ThreadContext threadContext,
		final RestHandler restHandler) {
	super();
	this.restHandler = restHandler;
	this.threadContext = threadContext;
}
 
Example #16
Source File: RangerElasticsearchPlugin.java    From ranger with Apache License 2.0 4 votes vote down vote up
@Override
public UnaryOperator<RestHandler> getRestHandlerWrapper(ThreadContext threadContext) {
	return (UnaryOperator<RestHandler>) (handler -> new RangerSecurityRestFilter(threadContext, handler));
}
 
Example #17
Source File: SqlPlug.java    From elasticsearch-sql with Apache License 2.0 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    return Collections.singletonList(new RestSqlAction());
}
 
Example #18
Source File: AnomalyDetectorPlugin.java    From anomaly-detection with Apache License 2.0 4 votes vote down vote up
@Override
public List<RestHandler> getRestHandlers(
    Settings settings,
    RestController restController,
    ClusterSettings clusterSettings,
    IndexScopedSettings indexScopedSettings,
    SettingsFilter settingsFilter,
    IndexNameExpressionResolver indexNameExpressionResolver,
    Supplier<DiscoveryNodes> nodesInCluster
) {
    AnomalyResultHandler anomalyResultHandler = new AnomalyResultHandler(
        client,
        settings,
        clusterService,
        indexNameExpressionResolver,
        anomalyDetectionIndices,
        threadPool
    );
    AnomalyDetectorJobRunner jobRunner = AnomalyDetectorJobRunner.getJobRunnerInstance();
    jobRunner.setClient(client);
    jobRunner.setClientUtil(clientUtil);
    jobRunner.setThreadPool(threadPool);
    jobRunner.setAnomalyResultHandler(anomalyResultHandler);
    jobRunner.setSettings(settings);

    AnomalyDetectorProfileRunner profileRunner = new AnomalyDetectorProfileRunner(
        client,
        this.xContentRegistry,
        this.nodeFilter,
        indexNameExpressionResolver,
        clusterService,
        Calendar.getInstance(TimeZone.getTimeZone("UTC"))
    );
    RestGetAnomalyDetectorAction restGetAnomalyDetectorAction = new RestGetAnomalyDetectorAction(profileRunner);
    RestIndexAnomalyDetectorAction restIndexAnomalyDetectorAction = new RestIndexAnomalyDetectorAction(
        settings,
        clusterService,
        anomalyDetectionIndices
    );
    RestSearchAnomalyDetectorAction searchAnomalyDetectorAction = new RestSearchAnomalyDetectorAction();
    RestSearchAnomalyResultAction searchAnomalyResultAction = new RestSearchAnomalyResultAction();
    RestDeleteAnomalyDetectorAction deleteAnomalyDetectorAction = new RestDeleteAnomalyDetectorAction(clusterService);
    RestExecuteAnomalyDetectorAction executeAnomalyDetectorAction = new RestExecuteAnomalyDetectorAction(
        settings,
        clusterService,
        anomalyDetectorRunner
    );
    RestStatsAnomalyDetectorAction statsAnomalyDetectorAction = new RestStatsAnomalyDetectorAction(
        adStats,
        this.nodeFilter,
        this.clusterService
    );
    RestAnomalyDetectorJobAction anomalyDetectorJobAction = new RestAnomalyDetectorJobAction(
        settings,
        clusterService,
        anomalyDetectionIndices
    );

    return ImmutableList
        .of(
            restGetAnomalyDetectorAction,
            restIndexAnomalyDetectorAction,
            searchAnomalyDetectorAction,
            searchAnomalyResultAction,
            deleteAnomalyDetectorAction,
            executeAnomalyDetectorAction,
            anomalyDetectorJobAction,
            statsAnomalyDetectorAction
        );
}