Package org.elasticsearch.action.admin.indices.settings

Examples of org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest


     *
     * @param indices The indices to update the settings for. Use <tt>null</tt> or <tt>_all</tt> to executed against all indices.
     * @return The request
     */
    public static UpdateSettingsRequest updateSettingsRequest(String... indices) {
        return new UpdateSettingsRequest(indices);
    }
View Full Code Here


* @author kimchy (shay.banon)
*/
public class UpdateSettingsRequestBuilder extends BaseIndicesRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse> {

    public UpdateSettingsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
        super(indicesClient, new UpdateSettingsRequest(indices));
    }
View Full Code Here

        controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
        controller.registerHandler(RestRequest.Method.PUT, "/_settings", this);
    }

    @Override public void handleRequest(final RestRequest request, final RestChannel channel) {
        UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(splitIndices(request.param("index")));
        ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder();
        String bodySettings = request.contentAsString();
        if (Strings.hasText(bodySettings)) {
            try {
                updateSettings.put(ImmutableSettings.settingsBuilder().loadFromSource(bodySettings).build());
            } catch (Exception e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, BAD_REQUEST, new SettingsException("Failed to parse index settings", e)));
                } catch (IOException e1) {
                    logger.warn("Failed to send response", e1);
                }
                return;
            }
        }
        for (Map.Entry<String, String> entry : request.params().entrySet()) {
            if (entry.getKey().equals("pretty")) {
                continue;
            }
            updateSettings.put(entry.getKey(), entry.getValue());
        }
        updateSettingsRequest.settings(updateSettings);

        client.admin().indices().updateSettings(updateSettingsRequest, new ActionListener<UpdateSettingsResponse>() {
            @Override public void onResponse(UpdateSettingsResponse updateSettingsResponse) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
View Full Code Here

*/
@SuppressWarnings("unused")
public class UpdateSettingsRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<UpdateSettingsRequest, UpdateSettingsResponse, JsonInput, JsonOutput> {

    public UpdateSettingsRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
        super(client, new UpdateSettingsRequest(), jsonToString, stringToJson);
    }
View Full Code Here

import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.settings.Settings;

public class UpdateSettingsUtils {
  static public void updateSettings(IndicesAdminClient client, String indexName, Settings settings) {
    client.updateSettings(new UpdateSettingsRequest(indexName).settings(settings)).actionGet();   
  }
View Full Code Here

                 .field("max_terms_per_doc", 10 + i)
                 .startArray("exclude").value("ignoredterm").endArray()
                 .field("exclude_regex","ignoredterm\\d")
                 .endObject().endObject().endObject().string();
         Settings settings = ImmutableSettings.settingsBuilder().loadFromSource(settingsSource).build();
         client.admin().indices().updateSettings(new UpdateSettingsRequest(settings,"test"))
                 .actionGet();

         client.admin().indices().clearCache(new ClearIndicesCacheRequest()).actionGet();

      SearchResponse searchResponse = client
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.