Convert to new settings infra

This commit is contained in:
Simon Willnauer 2016-01-27 15:52:34 +01:00
parent 1df7d4d5b5
commit 08f7071611
6 changed files with 8 additions and 5 deletions

View File

@ -65,6 +65,7 @@ import org.elasticsearch.indices.ttl.IndicesTTLService;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.repositories.fs.FsRepository; import org.elasticsearch.repositories.fs.FsRepository;
import org.elasticsearch.repositories.uri.URLRepository; import org.elasticsearch.repositories.uri.URLRepository;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptService;
import org.elasticsearch.search.SearchService; import org.elasticsearch.search.SearchService;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
@ -265,6 +266,7 @@ public final class ClusterSettings extends AbstractScopedSettings {
URLRepository.SUPPORTED_PROTOCOLS_SETTING, URLRepository.SUPPORTED_PROTOCOLS_SETTING,
TransportMasterNodeReadAction.FORCE_LOCAL_SETTING, TransportMasterNodeReadAction.FORCE_LOCAL_SETTING,
AutoCreateIndex.AUTO_CREATE_INDEX_SETTING, AutoCreateIndex.AUTO_CREATE_INDEX_SETTING,
BaseRestHandler.MULTI_ALLOW_EXPLICIT_INDEX,
ClusterModule.SHARDS_ALLOCATOR_TYPE_SETTING, ClusterModule.SHARDS_ALLOCATOR_TYPE_SETTING,
EsExecutors.PROCESSORS_SETTING))); EsExecutors.PROCESSORS_SETTING)));
} }

View File

@ -28,6 +28,7 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.client.FilterClient; import org.elasticsearch.client.FilterClient;
import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Set; import java.util.Set;
@ -41,7 +42,7 @@ import java.util.Set;
* {@link org.elasticsearch.rest.RestController#registerRelevantHeaders(String...)} * {@link org.elasticsearch.rest.RestController#registerRelevantHeaders(String...)}
*/ */
public abstract class BaseRestHandler extends AbstractComponent implements RestHandler { public abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX = Setting.boolSetting("rest.action.multi.allow_explicit_index", true, false, Setting.Scope.CLUSTER);
private final RestController controller; private final RestController controller;
private final Client client; private final Client client;
protected final ParseFieldMatcher parseFieldMatcher; protected final ParseFieldMatcher parseFieldMatcher;

View File

@ -67,7 +67,7 @@ public class RestBulkAction extends BaseRestHandler {
controller.registerHandler(POST, "/{index}/{type}/_bulk", this); controller.registerHandler(POST, "/{index}/{type}/_bulk", this);
controller.registerHandler(PUT, "/{index}/{type}/_bulk", this); controller.registerHandler(PUT, "/{index}/{type}/_bulk", this);
this.allowExplicitIndex = settings.getAsBoolean("rest.action.multi.allow_explicit_index", true); this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
} }
@Override @Override

View File

@ -50,7 +50,7 @@ public class RestMultiGetAction extends BaseRestHandler {
controller.registerHandler(GET, "/{index}/{type}/_mget", this); controller.registerHandler(GET, "/{index}/{type}/_mget", this);
controller.registerHandler(POST, "/{index}/{type}/_mget", this); controller.registerHandler(POST, "/{index}/{type}/_mget", this);
this.allowExplicitIndex = settings.getAsBoolean("rest.action.multi.allow_explicit_index", true); this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
} }
@Override @Override

View File

@ -53,7 +53,7 @@ public class RestMultiPercolateAction extends BaseRestHandler {
controller.registerHandler(GET, "/{index}/_mpercolate", this); controller.registerHandler(GET, "/{index}/_mpercolate", this);
controller.registerHandler(GET, "/{index}/{type}/_mpercolate", this); controller.registerHandler(GET, "/{index}/{type}/_mpercolate", this);
this.allowExplicitIndex = settings.getAsBoolean("rest.action.multi.allow_explicit_index", true); this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
} }
@Override @Override

View File

@ -78,7 +78,7 @@ public class RestMultiSearchAction extends BaseRestHandler {
controller.registerHandler(GET, "/{index}/{type}/_msearch/template", this); controller.registerHandler(GET, "/{index}/{type}/_msearch/template", this);
controller.registerHandler(POST, "/{index}/{type}/_msearch/template", this); controller.registerHandler(POST, "/{index}/{type}/_msearch/template", this);
this.allowExplicitIndex = settings.getAsBoolean("rest.action.multi.allow_explicit_index", true); this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
this.indicesQueriesRegistry = indicesQueriesRegistry; this.indicesQueriesRegistry = indicesQueriesRegistry;
} }