org.elasticsearch.rest.RestController Java Examples
The following examples show how to use
org.elasticsearch.rest.RestController.
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: InternalUsersApiAction.java From deprecated-security-advanced-modules with Apache License 2.0 | 6 votes |
@Inject public InternalUsersApiAction(final Settings settings, final Path configPath, final RestController controller, final Client client, final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs, final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) { super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool, auditLog); // legacy mapping for backwards compatibility // TODO: remove in next version controller.registerHandler(Method.GET, "/_opendistro/_security/api/user/{name}", this); controller.registerHandler(Method.GET, "/_opendistro/_security/api/user/", this); controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/user/{name}", this); controller.registerHandler(Method.PUT, "/_opendistro/_security/api/user/{name}", this); // corrected mapping, introduced in Open Distro Security controller.registerHandler(Method.GET, "/_opendistro/_security/api/internalusers/{name}", this); controller.registerHandler(Method.GET, "/_opendistro/_security/api/internalusers/", this); controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/internalusers/{name}", this); controller.registerHandler(Method.PUT, "/_opendistro/_security/api/internalusers/{name}", this); controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/internalusers/", this); controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/internalusers/{name}", this); }
Example #2
Source File: TasteSearchRestAction.java From elasticsearch-taste with Apache License 2.0 | 6 votes |
@Inject public TasteSearchRestAction(final Settings settings, final Client client, final RestController restController) { super(settings, restController, client); final String size = settings.get("taste.cache.search.size", "1000"); final String duration = settings.get("taste.cache.search.duration", "600000"); // 10min cache = CacheBuilder .newBuilder() .expireAfterAccess(Long.parseLong(duration), TimeUnit.MILLISECONDS) .maximumSize(Long.parseLong(size)).build(); restController.registerHandler(RestRequest.Method.GET, "/{index}/_taste/{objectType}/{systemId}", this); restController.registerHandler(RestRequest.Method.GET, "/{index}/{type}/_taste/{objectType}/{systemId}", this); }
Example #3
Source File: BundlePlugin.java From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 | 6 votes |
@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 #4
Source File: AbstractApiAction.java From deprecated-security-advanced-modules with Apache License 2.0 | 6 votes |
protected AbstractApiAction(final Settings settings, final Path configPath, final RestController controller, final Client client, final AdminDNs adminDNs, final ConfigurationRepository cl, final ClusterService cs, final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) { super(settings); this.settings = settings; this.opendistroIndex = settings.get(ConfigConstants.OPENDISTRO_SECURITY_CONFIG_INDEX_NAME, ConfigConstants.OPENDISTRO_SECURITY_DEFAULT_CONFIG_INDEX); this.cl = cl; this.cs = cs; this.threadPool = threadPool; this.restApiPrivilegesEvaluator = new RestApiPrivilegesEvaluator(settings, adminDNs, evaluator, principalExtractor, configPath, threadPool); this.auditLog = auditLog; }
Example #5
Source File: TasteActionRestAction.java From elasticsearch-taste with Apache License 2.0 | 6 votes |
@Inject public TasteActionRestAction(final Settings settings, final RestController restController, final Client client, final ThreadPool pool, final TasteService tasteService) { super(settings, restController, client); this.pool = pool; this.tasteService = tasteService; restController.registerHandler(RestRequest.Method.GET, "/_taste/action", this); restController.registerHandler(RestRequest.Method.GET, "/_taste/action/{name}", this); restController.registerHandler(RestRequest.Method.POST, "/_taste/action/{action}", this); restController.registerHandler(RestRequest.Method.DELETE, "/_taste/action/{name}", this); }
Example #6
Source File: TasteEventRestAction.java From elasticsearch-taste with Apache License 2.0 | 6 votes |
@Inject public TasteEventRestAction(final Settings settings, final Client client, final RestController restController, final ThreadPool pool) { super(settings, restController, client); this.pool = pool; restController.registerHandler(RestRequest.Method.POST, "/{index}/_taste/event", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_taste/event", this); userRequestHandler = new UserRequestHandler(settings, client, pool); itemRequestHandler = new ItemRequestHandler(settings, client, pool); preferenceRequestHandler = new PreferenceRequestHandler(settings, client, pool); }
Example #7
Source File: ReindexRestAction.java From elasticsearch-reindexing with Apache License 2.0 | 6 votes |
@Inject public ReindexRestAction(final Settings settings, final Client client, final RestController restController, final ReindexingService reindexingService) { super(settings, restController, client); this.reindexingService = reindexingService; restController.registerHandler(RestRequest.Method.GET, "/_reindex", this); restController.registerHandler(RestRequest.Method.GET, "/_reindex/{name}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_reindex/{toindex}/{totype}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_reindex/{toindex}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_reindex/{toindex}/{totype}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_reindex/{toindex}", this); restController.registerHandler(RestRequest.Method.DELETE, "/_reindex/{name}", this); }
Example #8
Source File: CSVRestSearchAction.java From elasticsearch-csv with Apache License 2.0 | 6 votes |
@Inject public CSVRestSearchAction(Settings settings, Client client, RestController controller) { super(settings, controller, client); controller.registerHandler(GET, "/_search_csv", this); controller.registerHandler(POST, "/_search_csv", this); controller.registerHandler(GET, "/{index}/_search_csv", this); controller.registerHandler(POST, "/{index}/_search_csv", this); controller.registerHandler(GET, "/{index}/{type}/_search_csv", this); controller.registerHandler(POST, "/{index}/{type}/_search_csv", this); controller.registerHandler(GET, "/_search_csv/template", this); controller.registerHandler(POST, "/_search_csv/template", this); controller.registerHandler(GET, "/{index}/_search_csv/template", this); controller.registerHandler(POST, "/{index}/_search_csv/template", this); controller.registerHandler(GET, "/{index}/{type}/_search_csv/template", this); controller.registerHandler(POST, "/{index}/{type}/_search_csv/template", this); }
Example #9
Source File: RestCoordinateSearchAction.java From siren-join with GNU Affero General Public License v3.0 | 6 votes |
@Inject public RestCoordinateSearchAction(final Settings settings, final RestController controller, final Client client) { super(settings, controller, client); controller.registerHandler(GET, "/_coordinate_search", this); controller.registerHandler(POST, "/_coordinate_search", this); controller.registerHandler(GET, "/{index}/_coordinate_search", this); controller.registerHandler(POST, "/{index}/_coordinate_search", this); controller.registerHandler(GET, "/{index}/{type}/_coordinate_search", this); controller.registerHandler(POST, "/{index}/{type}/_coordinate_search", this); controller.registerHandler(GET, "/_coordinate_search/template", this); controller.registerHandler(POST, "/_coordinate_search/template", this); controller.registerHandler(GET, "/{index}/_coordinate_search/template", this); controller.registerHandler(POST, "/{index}/_coordinate_search/template", this); controller.registerHandler(GET, "/{index}/{type}/_coordinate_search/template", this); controller.registerHandler(POST, "/{index}/{type}/_coordinate_search/template", this); // TODO: Redirects to original rest exists action, therefore it will not support filterjoin filter. It would be better to have our own coordinate exists action. RestExistsAction restExistsAction = new RestExistsAction(settings, controller, client); controller.registerHandler(GET, "/_coordinate_search/exists", restExistsAction); controller.registerHandler(POST, "/_coordinate_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/_coordinate_search/exists", restExistsAction); controller.registerHandler(POST, "/{index}/_coordinate_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/{type}/_coordinate_search/exists", restExistsAction); controller.registerHandler(POST, "/{index}/{type}/_coordinate_search/exists", restExistsAction); }
Example #10
Source File: RestIngestAction.java From elasticsearch-helper with Apache License 2.0 | 6 votes |
@Inject public RestIngestAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(POST, "/_ingest", this); controller.registerHandler(PUT, "/_ingest", this); controller.registerHandler(POST, "/{index}/_ingest", this); controller.registerHandler(PUT, "/{index}/_ingest", this); controller.registerHandler(POST, "/{index}/{type}/_ingest", this); controller.registerHandler(PUT, "/{index}/{type}/_ingest", this); int actions = settings.getAsInt("action.ingest.maxactions", 1000); int concurrency = settings.getAsInt("action.ingest.maxconcurrency", Runtime.getRuntime().availableProcessors() * 4); ByteSizeValue volume = settings.getAsBytesSize("action.ingest.maxvolume", ByteSizeValue.parseBytesSizeValue("10m", "action.ingest.maxvolume")); this.ingestProcessor = new IngestProcessor(client) .maxActions(actions) .maxConcurrentRequests(concurrency) .maxVolumePerRequest(volume); }
Example #11
Source File: AuthService.java From elasticsearch-auth with Apache License 2.0 | 6 votes |
@Inject public AuthService(final Settings settings, final Client client, final RestController restController) { super(settings); this.client = client; this.restController = restController; logger.info("Creating authenticators."); constraintIndex = settings.get("auth.constraint.index", DEFAULT_CONSTRAINT_INDEX_NAME); constraintType = settings.get("auth.constraint.type", DEFAULT_CONSTRAINT_TYPE); cookieTokenName = settings.get("auth.token.cookie", DEFAULT_COOKIE_TOKEN_NAME); updateToken = settings.getAsBoolean("auth.token.update_by_request", true); guestRole = settings.get("auth.role.guest", DEFAULT_GUEST_ROLE); if (cookieTokenName.trim().length() == 0 || "false".equalsIgnoreCase(cookieTokenName)) { cookieToken = false; } }
Example #12
Source File: RestIndexPutAliasAction.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Inject public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(PUT, "/{index}/_alias/{name}", this); controller.registerHandler(PUT, "/_alias/{name}", this); controller.registerHandler(PUT, "/{index}/_aliases/{name}", this); controller.registerHandler(PUT, "/_aliases/{name}", this); controller.registerHandler(PUT, "/{index}/_alias", this); controller.registerHandler(PUT, "/_alias", this); controller.registerHandler(POST, "/{index}/_alias/{name}", this); controller.registerHandler(POST, "/_alias/{name}", this); controller.registerHandler(POST, "/{index}/_aliases/{name}", this); controller.registerHandler(POST, "/_aliases/{name}", this); controller.registerHandler(PUT, "/{index}/_aliases", this); //we cannot add POST for "/_aliases" because this is the _aliases api already defined in RestIndicesAliasesAction }
Example #13
Source File: RestSearchAction.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Inject public RestSearchAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(GET, "/_search", this); controller.registerHandler(POST, "/_search", this); controller.registerHandler(GET, "/{index}/_search", this); controller.registerHandler(POST, "/{index}/_search", this); controller.registerHandler(GET, "/{index}/{type}/_search", this); controller.registerHandler(POST, "/{index}/{type}/_search", this); controller.registerHandler(GET, "/_search/template", this); controller.registerHandler(POST, "/_search/template", this); controller.registerHandler(GET, "/{index}/_search/template", this); controller.registerHandler(POST, "/{index}/_search/template", this); controller.registerHandler(GET, "/{index}/{type}/_search/template", this); controller.registerHandler(POST, "/{index}/{type}/_search/template", this); RestExistsAction restExistsAction = new RestExistsAction(settings, controller, client); controller.registerHandler(GET, "/_search/exists", restExistsAction); controller.registerHandler(POST, "/_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/_search/exists", restExistsAction); controller.registerHandler(POST, "/{index}/_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/{type}/_search/exists", restExistsAction); controller.registerHandler(POST, "/{index}/{type}/_search/exists", restExistsAction); }
Example #14
Source File: LtrQueryParserPlugin.java From elasticsearch-learning-to-rank with Apache License 2.0 | 5 votes |
@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 #15
Source File: RestSimpleFeatureStore.java From elasticsearch-learning-to-rank with Apache License 2.0 | 5 votes |
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 #16
Source File: DataFormatPlugin.java From elasticsearch-dataformat with Apache License 2.0 | 5 votes |
@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 #17
Source File: RestLangdetectAction.java From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 | 5 votes |
@Inject public RestLangdetectAction(Settings settings, RestController controller) { super(settings); controller.registerHandler(GET, "/_langdetect", this); controller.registerHandler(GET, "/_langdetect/{profile}", this); controller.registerHandler(POST, "/_langdetect", this); controller.registerHandler(POST, "/_langdetect/{profile}", this); }
Example #18
Source File: TaskRestHandler.java From elasticsearch-rest-command with The Unlicense | 5 votes |
@Inject public TaskRestHandler(Settings settings, Client client, RestController controller) { super(settings, controller, client); this.client = client; controller.registerHandler(GET, "/_task", this); controller.registerHandler(POST, "/_task", this); controller.registerHandler(GET, "/_taskstatus/{taskid}", this); }
Example #19
Source File: CommandRestHandler.java From elasticsearch-rest-command with The Unlicense | 5 votes |
@Inject public CommandRestHandler(Settings settings, Client client, RestController controller) { super(settings, controller, client); controller.registerHandler(GET, "/_command", this); controller.registerHandler(POST, "/_command", this); }
Example #20
Source File: JobRestHandler.java From elasticsearch-rest-command with The Unlicense | 5 votes |
@Inject public JobRestHandler(Settings settings, Client client, RestController controller) { super(settings, controller, client); controller.registerHandler(GET, "/_commandjob", this); controller.registerHandler(POST, "/_commandjob", this); controller.registerHandler(GET, "/jobs/{jobid}/{type}", this); controller.registerHandler(POST, "/jobs/{jobid}/{type}", this); }
Example #21
Source File: RestCoordinateMultiSearchAction.java From siren-join with GNU Affero General Public License v3.0 | 5 votes |
@Inject public RestCoordinateMultiSearchAction(final Settings settings, final RestController controller, final Client client) { super(settings, controller, client); controller.registerHandler(GET, "/_coordinate_msearch", this); controller.registerHandler(POST, "/_coordinate_msearch", this); controller.registerHandler(GET, "/{index}/_coordinate_msearch", this); controller.registerHandler(POST, "/{index}/_coordinate_msearch", this); controller.registerHandler(GET, "/{index}/{type}/_coordinate_msearch", this); controller.registerHandler(POST, "/{index}/{type}/_coordinate_msearch", this); this.allowExplicitIndex = settings.getAsBoolean("rest.action.multi.allow_explicit_index", true); }
Example #22
Source File: RestExtendedAnalyzeAction.java From elasticsearch-extended-analyze with Apache License 2.0 | 5 votes |
@Inject public RestExtendedAnalyzeAction(Settings settings, Client client, RestController controller) { super(settings, controller, client); controller.registerHandler(GET, "/_extended_analyze", this); controller.registerHandler(GET, "/{index}/_extended_analyze", this); controller.registerHandler(POST, "/_extended_analyze", this); controller.registerHandler(POST, "/{index}/_extended_analyze", this); }
Example #23
Source File: Node.java From Elasticsearch with Apache License 2.0 | 5 votes |
private Node stop() { if (!lifecycle.moveToStopped()) { return this; } ESLogger logger = Loggers.getLogger(Node.class, settings.get("name")); logger.info("stopping ..."); injector.getInstance(TribeService.class).stop(); injector.getInstance(ResourceWatcherService.class).stop(); if (settings.getAsBoolean("http.enabled", true)) { injector.getInstance(HttpServer.class).stop(); } injector.getInstance(SnapshotsService.class).stop(); injector.getInstance(SnapshotShardsService.class).stop(); // stop any changes happening as a result of cluster state changes injector.getInstance(IndicesClusterStateService.class).stop(); // we close indices first, so operations won't be allowed on it injector.getInstance(IndexingMemoryController.class).stop(); injector.getInstance(IndicesTTLService.class).stop(); injector.getInstance(RoutingService.class).stop(); injector.getInstance(ClusterService.class).stop(); injector.getInstance(DiscoveryService.class).stop(); injector.getInstance(MonitorService.class).stop(); injector.getInstance(GatewayService.class).stop(); injector.getInstance(SearchService.class).stop(); injector.getInstance(RestController.class).stop(); injector.getInstance(TransportService.class).stop(); for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) { injector.getInstance(plugin).stop(); } // we should stop this last since it waits for resources to get released // if we had scroll searchers etc or recovery going on we wait for to finish. injector.getInstance(IndicesService.class).stop(); logger.info("stopped"); return this; }
Example #24
Source File: ReloadRestAction.java From elasticsearch-auth with Apache License 2.0 | 5 votes |
@Inject public ReloadRestAction(final Settings settings, final Client client, final RestController restController, final AuthService authService) { super(settings, restController, client); this.authService = authService; restController.registerHandler(RestRequest.Method.POST, "/_auth/reload", this); }
Example #25
Source File: RestTermVectorsAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public RestTermVectorsAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/_termvectors", this); controller.registerHandler(POST, "/{index}/{type}/_termvectors", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_termvectors", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_termvectors", this); // we keep usage of _termvector as alias for now controller.registerHandler(GET, "/{index}/{type}/_termvector", this); controller.registerHandler(POST, "/{index}/{type}/_termvector", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_termvector", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_termvector", this); }
Example #26
Source File: RestSuggestAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public RestSuggestAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(POST, "/_suggest", this); controller.registerHandler(GET, "/_suggest", this); controller.registerHandler(POST, "/{index}/_suggest", this); controller.registerHandler(GET, "/{index}/_suggest", this); }
Example #27
Source File: AccountRestAction.java From elasticsearch-auth with Apache License 2.0 | 5 votes |
@Inject public AccountRestAction(final Settings settings, final Client client, final RestController restController, final AuthService authService) { super(settings, restController, client); this.authService = authService; restController.registerHandler(RestRequest.Method.POST, "/_auth/account", this); restController.registerHandler(RestRequest.Method.PUT, "/_auth/account", this); restController.registerHandler(RestRequest.Method.DELETE, "/_auth/account", this); }
Example #28
Source File: RestDataAction.java From elasticsearch-dataformat with Apache License 2.0 | 5 votes |
public RestDataAction(final Settings settings, final RestController restController) { this.maxMemory = Runtime.getRuntime().maxMemory(); this.defaultLimit = (long) (maxMemory * (DEFAULT_LIMIT_PERCENTAGE / 100F)); logger.info("Default limit: {}", defaultLimit); }
Example #29
Source File: RestRenderSearchTemplateAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public RestRenderSearchTemplateAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(GET, "/_render/template", this); controller.registerHandler(POST, "/_render/template", this); controller.registerHandler(GET, "/_render/template/{id}", this); controller.registerHandler(POST, "/_render/template/{id}", this); }
Example #30
Source File: OpenShiftElasticSearchPlugin.java From openshift-elasticsearch-plugin with Apache License 2.0 | 5 votes |
@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; }