Java Code Examples for org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest#transientSettings()

The following examples show how to use org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest#transientSettings() . 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: ESClusterUpdateSettingsTask.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public ESClusterUpdateSettingsTask(UUID jobId,
                                   TransportClusterUpdateSettingsAction transport,
                                   ESClusterUpdateSettingsNode node) {
    super(jobId);
    this.transport = transport;

    final SettableFuture<TaskResult> result = SettableFuture.create();
    results = Collections.<ListenableFuture<TaskResult>>singletonList(result);

    request = new ClusterUpdateSettingsRequest();
    request.persistentSettings(node.persistentSettings());
    request.transientSettings(node.transientSettings());
    if (node.persistentSettingsToRemove() != null) {
        request.persistentSettingsToRemove(node.persistentSettingsToRemove());
    }
    if (node.transientSettingsToRemove() != null) {
        request.transientSettingsToRemove(node.transientSettingsToRemove());
    }
    listener = ActionListeners.wrap(result, Functions.constant(TaskResult.ONE_ROW));
}
 
Example 2
Source File: CaseController.java    From skywalking with Apache License 2.0 6 votes vote down vote up
private void putSettings() throws IOException {
    ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
    String transientSettingKey =
        RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey();
    int transientSettingValue = 10;
    Settings transientSettings = Settings.builder()
            .put(transientSettingKey, transientSettingValue, ByteSizeUnit.BYTES)
            .build();
    request.transientSettings(transientSettings);
    ClusterUpdateSettingsResponse response = client.cluster().putSettings(request, RequestOptions.DEFAULT);
    if (response == null) {
        String message = "elasticsearch put settings fail.";
        logger.error(message);
        throw new RuntimeException(message);
    }
}
 
Example 3
Source File: ClusterClientPutSettingsMethodsInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
    ClusterUpdateSettingsRequest updateSettingsRequest = (ClusterUpdateSettingsRequest) (allArguments[0]);

    RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
    if (restClientEnhanceInfo != null) {
        AbstractSpan span = ContextManager
            .createExitSpan(Constants.CLUSTER_PUT_SETTINGS_NAME, restClientEnhanceInfo.getPeers());
        span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);

        Tags.DB_TYPE.set(span, DB_TYPE);
        if (TRACE_DSL) {
            StringBuilder sb = new StringBuilder("persistent:[");
            Settings persist = updateSettingsRequest.persistentSettings();
            if (persist != null) {
                sb.append(persist.toString());
            }
            sb.append("]---transient:[");
            Settings transi = updateSettingsRequest.transientSettings();
            if (transi != null) {
                sb.append(transi.toString());
            }
            sb.append("]");
            Tags.DB_STATEMENT.set(span, sb.toString());
        }
        SpanLayer.asDB(span);
    }
}