org.elasticsearch.cluster.ClusterModule Java Examples
The following examples show how to use
org.elasticsearch.cluster.ClusterModule.
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: SQLPlugin.java From Elasticsearch with Apache License 2.0 | 5 votes |
private void registerSettings(ClusterModule clusterModule, Collection<? extends Setting> settings) { for (Setting setting : settings) { /** * validation is done in * {@link io.crate.analyze.SettingsAppliers.AbstractSettingsApplier#apply(org.elasticsearch.common.settings.Settings.Builder, Object[], io.crate.sql.tree.Expression)} * here we use Validator.EMPTY, since ES ignores invalid settings silently **/ clusterModule.registerClusterDynamicSetting(setting.settingName(), Validator.EMPTY); registerSettings(clusterModule, setting.children()); } }
Example #2
Source File: EngineTestCase.java From crate with Apache License 2.0 | 5 votes |
public static MapperService createMapperService(String type) throws IOException { IndexMetaData indexMetaData = IndexMetaData.builder("test") .settings(Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)) .putMapping(type, "{\"properties\": {}}") .build(); MapperService mapperService = MapperTestUtils.newMapperService(new NamedXContentRegistry(ClusterModule.getNamedXWriteables()), createTempDir(), Settings.EMPTY, "test"); mapperService.merge(indexMetaData, MapperService.MergeReason.MAPPING_UPDATE, false); return mapperService; }
Example #3
Source File: ESIntegTestCase.java From crate with Apache License 2.0 | 5 votes |
@Override protected NamedXContentRegistry xContentRegistry() { if (isInternalCluster() && cluster().size() > 0) { // If it's internal cluster - using existing registry in case plugin registered custom data return internalCluster().getInstance(NamedXContentRegistry.class); } else { // If it's external cluster - fall back to the standard set return new NamedXContentRegistry(ClusterModule.getNamedXWriteables()); } }
Example #4
Source File: MockTransportService.java From crate with Apache License 2.0 | 5 votes |
public static MockTcpTransport newMockTransport(Settings settings, Version version, ThreadPool threadPool) { // some tests use MockTransportService to do network based testing. Yet, we run tests in multiple JVMs that means // concurrent tests could claim port that another JVM just released and if that test tries to simulate a disconnect it might // be smart enough to re-connect depending on what is tested. To reduce the risk, since this is very hard to debug we use // a different default port range per JVM unless the incoming settings override it int basePort = 10300 + (JVM_ORDINAL * 100); // use a non-default port otherwise some cluster in this JVM might reuse a port settings = Settings.builder().put(TransportSettings.PORT.getKey(), basePort + "-" + (basePort + 100)).put(settings).build(); NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); return new MockTcpTransport(settings, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Collections.emptyList()), version); }
Example #5
Source File: ElasticsearchJavaAPIScriptTest.java From syncer with BSD 3-Clause "New" or "Revised" License | 4 votes |
private NamedXContentRegistry xContentRegistry() { return new NamedXContentRegistry(ClusterModule.getNamedXWriteables()); }
Example #6
Source File: ElasticsearchNodeCommand.java From crate with Apache License 2.0 | 4 votes |
public ElasticsearchNodeCommand(String description) { super(description); nodeOrdinalOption = parser.accepts("ordinal", "Optional node ordinal, 0 if not specified") .withRequiredArg().ofType(Integer.class); namedXContentRegistry = new NamedXContentRegistry(ClusterModule.getNamedXWriteables()); }
Example #7
Source File: NodeRepurposeCommandTests.java From crate with Apache License 2.0 | 4 votes |
private Manifest loadManifest() throws IOException { return Manifest.FORMAT.loadLatestState(logger, new NamedXContentRegistry(ClusterModule.getNamedXWriteables()), nodePaths); }
Example #8
Source File: ESTestCase.java From crate with Apache License 2.0 | 4 votes |
/** * The {@link NamedXContentRegistry} to use for this test. Subclasses should override and use liberally. */ protected NamedXContentRegistry xContentRegistry() { return new NamedXContentRegistry(ClusterModule.getNamedXWriteables()); }
Example #9
Source File: ESTestCase.java From crate with Apache License 2.0 | 4 votes |
/** * The {@link NamedWriteableRegistry} to use for this test. Subclasses should override and use liberally. */ protected NamedWriteableRegistry writableRegistry() { return new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); }
Example #10
Source File: MockTransport.java From crate with Apache License 2.0 | 4 votes |
protected NamedWriteableRegistry writeableRegistry() { return new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); }
Example #11
Source File: SnapshotsInProgressSerializationTests.java From crate with Apache License 2.0 | 4 votes |
@Override protected NamedWriteableRegistry getNamedWriteableRegistry() { return new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); }
Example #12
Source File: CustomMetaDataTest.java From crate with Apache License 2.0 | 4 votes |
private NamedXContentRegistry getNamedXContentRegistry() { List<NamedXContentRegistry.Entry> registry = new ArrayList<>(); registry.addAll(new SQLPlugin(Settings.EMPTY).getNamedXContent()); registry.addAll(ClusterModule.getNamedXWriteables()); return new NamedXContentRegistry(registry); }
Example #13
Source File: SQLPlugin.java From Elasticsearch with Apache License 2.0 | 3 votes |
public void onModule(ClusterModule clusterModule) { // add our dynamic cluster settings clusterModule.registerClusterDynamicSetting(Constants.CUSTOM_ANALYSIS_SETTINGS_PREFIX + "*", Validator.EMPTY); clusterModule.registerClusterDynamicSetting(CrateCircuitBreakerService.QUERY_CIRCUIT_BREAKER_LIMIT_SETTING, Validator.MEMORY_SIZE); clusterModule.registerClusterDynamicSetting(CrateCircuitBreakerService.QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING, Validator.NON_NEGATIVE_DOUBLE); clusterModule.registerClusterDynamicSetting("crate.internal.decommission.*", Validator.EMPTY); registerSettings(clusterModule, CrateSettings.CRATE_SETTINGS); clusterModule.registerAllocationDecider(DecommissionAllocationDecider.class); }