Examples of UpdateSettingsRequest


Examples of com.dotcms.repackage.org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest

  public  void moveIndexToLocalNode(String index) throws IOException {
        Client client=new ESClient().getClient();
//        String nodeName="dotCMS_" + Config.getStringProperty("DIST_INDEXATION_SERVER_ID");
        String nodeName="dotCMS_" + APILocator.getServerAPI().readServerId();
        UpdateSettingsResponse resp=client.admin().indices().updateSettings(
          new UpdateSettingsRequest(index).settings(
                jsonBuilder().startObject()
                     .startObject("index")
                        .field("number_of_replicas",0)
                        .field("routing.allocation.include._name",nodeName)
                     .endObject()
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest

   */
    public  void moveIndexBackToCluster(String index) throws IOException {
        Client client=new ESClient().getClient();
        int nreplicas=Config.getIntProperty("es.index.number_of_replicas",0);
        UpdateSettingsResponse resp=client.admin().indices().updateSettings(
          new UpdateSettingsRequest(index).settings(
                jsonBuilder().startObject()
                     .startObject("index")
                        .field("number_of_replicas",nreplicas)
                        .field("routing.allocation.include._name","*")
                     .endObject()
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest

                                            put( "script.native.related.type", RelationshipSortOrderScriptFactory.class.getCanonicalName() ).build()
                            ).build().start();

                    try {
                        UpdateSettingsResponse resp = _nodeInstance.client().admin().indices().updateSettings(
                                new UpdateSettingsRequest().settings(
                                        jsonBuilder().startObject()
                                                .startObject( "index" )
                                                .field( "auto_expand_replicas", "0-all" )
                                                .endObject()
                                                .endObject().string()
View Full Code Here

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

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

* @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

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

        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

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

*/
@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

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

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

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

                 .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

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

        // http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings/
        sb.put("index.blocks.write", true); // Block writing.
        sb.put("index.blocks.read", false); // Allow reading.
        sb.put("index.blocks.metadata", false); // Allow getting metadata.

        c.admin().indices().updateSettings(new UpdateSettingsRequest(index).settings(sb.build())).actionGet();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.