org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction Java Examples

The following examples show how to use org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction. 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: HttpInvoker.java    From elasticsearch-helper with Apache License 2.0 6 votes vote down vote up
public HttpInvoker(Settings settings, ThreadPool threadPool, Headers headers, URL url) {
    super(settings, threadPool, headers);
    this.contexts = new HashMap<>();
    this.bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool()));
    bootstrap.setPipelineFactory(new HttpInvoker.HttpClientPipelineFactory());
    bootstrap.setOption("tcpNoDelay", true);

    registerAction(BulkAction.INSTANCE, HttpBulkAction.class);
    registerAction(CreateIndexAction.INSTANCE, HttpCreateIndexAction.class);
    registerAction(RefreshAction.INSTANCE, HttpRefreshIndexAction.class);
    registerAction(ClusterUpdateSettingsAction.INSTANCE, HttpClusterUpdateSettingsAction.class);
    registerAction(UpdateSettingsAction.INSTANCE, HttpUpdateSettingsAction.class);
    registerAction(SearchAction.INSTANCE, HttpSearchAction.class);

    this.url = url;
}
 
Example #2
Source File: BaseClient.java    From elasticsearch-helper with Apache License 2.0 6 votes vote down vote up
public void updateIndexSetting(String index, String key, Object value) throws IOException {
    if (client() == null) {
        return;
    }
    if (index == null) {
        throw new IOException("no index name given");
    }
    if (key == null) {
        throw new IOException("no key given");
    }
    if (value == null) {
        throw new IOException("no value given");
    }
    Settings.Builder settingsBuilder = Settings.settingsBuilder();
    settingsBuilder.put(key, value.toString());
    UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(index)
            .settings(settingsBuilder);
    client().execute(UpdateSettingsAction.INSTANCE, updateSettingsRequest).actionGet();
}
 
Example #3
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<UpdateSettingsResponse> updateSettings(final UpdateSettingsRequest request) {
    return execute(UpdateSettingsAction.INSTANCE, request);
}
 
Example #4
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void updateSettings(final UpdateSettingsRequest request, final ActionListener<UpdateSettingsResponse> listener) {
    execute(UpdateSettingsAction.INSTANCE, request, listener);
}
 
Example #5
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public UpdateSettingsRequestBuilder prepareUpdateSettings(String... indices) {
    return new UpdateSettingsRequestBuilder(this, UpdateSettingsAction.INSTANCE).setIndices(indices);
}
 
Example #6
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<AcknowledgedResponse> updateSettings(final UpdateSettingsRequest request) {
    return execute(UpdateSettingsAction.INSTANCE, request);
}
 
Example #7
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void updateSettings(final UpdateSettingsRequest request, final ActionListener<AcknowledgedResponse> listener) {
    execute(UpdateSettingsAction.INSTANCE, request, listener);
}
 
Example #8
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public UpdateSettingsRequestBuilder prepareUpdateSettings(String... indices) {
    return new UpdateSettingsRequestBuilder(this, UpdateSettingsAction.INSTANCE).setIndices(indices);
}
 
Example #9
Source File: ActionModule.java    From crate with Apache License 2.0 4 votes vote down vote up
static Map<String, ActionHandler<?, ?>> setupActions(List<ActionPlugin> actionPlugins) {
    // Subclass NamedRegistry for easy registration
    class ActionRegistry extends NamedRegistry<ActionHandler<?, ?>> {
        ActionRegistry() {
            super("action");
        }

        public void register(ActionHandler<?, ?> handler) {
            register(handler.getAction().name(), handler);
        }

        public <Request extends TransportRequest, Response extends TransportResponse> void register(
                GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
                Class<?>... supportTransportActions) {
            register(new ActionHandler<>(action, transportAction, supportTransportActions));
        }
    }

    ActionRegistry actions = new ActionRegistry();
    actions.register(ClusterStateAction.INSTANCE, TransportClusterStateAction.class);
    actions.register(ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class);
    actions.register(ClusterUpdateSettingsAction.INSTANCE, TransportClusterUpdateSettingsAction.class);
    actions.register(ClusterRerouteAction.INSTANCE, TransportClusterRerouteAction.class);
    actions.register(PendingClusterTasksAction.INSTANCE, TransportPendingClusterTasksAction.class);
    actions.register(PutRepositoryAction.INSTANCE, TransportPutRepositoryAction.class);
    actions.register(DeleteRepositoryAction.INSTANCE, TransportDeleteRepositoryAction.class);
    actions.register(GetSnapshotsAction.INSTANCE, TransportGetSnapshotsAction.class);
    actions.register(DeleteSnapshotAction.INSTANCE, TransportDeleteSnapshotAction.class);
    actions.register(CreateSnapshotAction.INSTANCE, TransportCreateSnapshotAction.class);
    actions.register(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
    actions.register(IndicesStatsAction.INSTANCE, TransportIndicesStatsAction.class);
    actions.register(CreateIndexAction.INSTANCE, TransportCreateIndexAction.class);
    actions.register(ResizeAction.INSTANCE, TransportResizeAction.class);
    actions.register(DeleteIndexAction.INSTANCE, TransportDeleteIndexAction.class);
    actions.register(PutMappingAction.INSTANCE, TransportPutMappingAction.class);
    actions.register(UpdateSettingsAction.INSTANCE, TransportUpdateSettingsAction.class);
    actions.register(PutIndexTemplateAction.INSTANCE, TransportPutIndexTemplateAction.class);
    actions.register(GetIndexTemplatesAction.INSTANCE, TransportGetIndexTemplatesAction.class);
    actions.register(DeleteIndexTemplateAction.INSTANCE, TransportDeleteIndexTemplateAction.class);
    actions.register(RefreshAction.INSTANCE, TransportRefreshAction.class);
    actions.register(SyncedFlushAction.INSTANCE, TransportSyncedFlushAction.class);
    actions.register(ForceMergeAction.INSTANCE, TransportForceMergeAction.class);
    actions.register(UpgradeAction.INSTANCE, TransportUpgradeAction.class);
    actions.register(UpgradeSettingsAction.INSTANCE, TransportUpgradeSettingsAction.class);
    actions.register(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
    actions.register(AddVotingConfigExclusionsAction.INSTANCE, TransportAddVotingConfigExclusionsAction.class);
    actions.register(ClearVotingConfigExclusionsAction.INSTANCE, TransportClearVotingConfigExclusionsAction.class);
    actions.register(NodesStatsAction.INSTANCE, TransportNodesStatsAction.class);

    actionPlugins.stream().flatMap(p -> p.getActions().stream()).forEach(actions::register);

    return unmodifiableMap(actions.getRegistry());
}