org.elasticsearch.cluster.metadata.MetaData.persistentSettings()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.elasticsearch.cluster.metadata.MetaData.persistentSettings()方法的一些代码示例,展示了MetaData.persistentSettings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaData.persistentSettings()方法的具体详情如下:
包路径:org.elasticsearch.cluster.metadata.MetaData
类名称:MetaData
方法名:persistentSettings

MetaData.persistentSettings介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

builder.field("cluster_uuid", metaData.clusterUUID);
if (!metaData.persistentSettings().isEmpty()) {
  builder.startObject("settings");
  metaData.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
  builder.endObject();

代码示例来源:origin: org.elasticsearch/elasticsearch

static ClusterGetSettingsResponse response(
    final ClusterState state,
    final boolean renderDefaults,
    final SettingsFilter settingsFilter,
    final ClusterSettings clusterSettings,
    final Settings settings) {
  return new ClusterGetSettingsResponse(
      settingsFilter.filter(state.metaData().persistentSettings()),
      settingsFilter.filter(state.metaData().transientSettings()),
      renderDefaults ? settingsFilter.filter(clusterSettings.diff(state.metaData().settings(), settings)) : Settings.EMPTY);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

partitionKnownAndValidSettings(currentState.metaData().persistentSettings(), "persistent", logger);
final Settings knownAndValidPersistentSettings = partitionedPersistentSettings.v1();
final Settings unknownOrInvalidPersistentSettings = partitionedPersistentSettings.v2();

代码示例来源:origin: org.elasticsearch/elasticsearch

if (metaData.persistentSettings() != null) {
  Settings settings = metaData.persistentSettings();
  clusterSettings.validateUpdate(settings);
  mdBuilder.persistentSettings(settings);

代码示例来源:origin: jprante/elasticsearch-gatherer

private Settings getSettings() {
  return clusterService.state().getMetaData().persistentSettings();
}

代码示例来源:origin: harbby/presto-connectors

@Override
  public RestResponse buildResponse(ClusterStateResponse response, XContentBuilder builder) throws Exception {
    builder.startObject();
    builder.startObject("persistent");
    response.getState().metaData().persistentSettings().toXContent(builder, request);
    builder.endObject();
    builder.startObject("transient");
    response.getState().metaData().transientSettings().toXContent(builder, request);
    builder.endObject();
    builder.endObject();
    return new BytesRestResponse(RestStatus.OK, builder);
  }
});

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private XContentBuilder renderResponse(ClusterState state, boolean renderDefaults, XContentBuilder builder, ToXContent.Params params)
      throws IOException {
    builder.startObject();

    builder.startObject("persistent");
    state.metaData().persistentSettings().toXContent(builder, params);
    builder.endObject();

    builder.startObject("transient");
    state.metaData().transientSettings().toXContent(builder, params);
    builder.endObject();

    if (renderDefaults) {
      builder.startObject("defaults");
      settingsFilter.filter(clusterSettings.diff(state.metaData().settings(), this.settings)).toXContent(builder, params);
      builder.endObject();
    }

    builder.endObject();
    return builder;
  }
}

代码示例来源:origin: javanna/elasticshell

@Override
  protected XContentBuilder toXContent(ClusterStateRequest request, ClusterStateResponse response, XContentBuilder builder) throws IOException {
    builder.startObject();

    builder.startObject("persistent");
    for (Map.Entry<String, String> entry : response.getState().metaData().persistentSettings().getAsMap().entrySet()) {
      builder.field(entry.getKey(), entry.getValue());
    }
    builder.endObject();

    builder.startObject("transient");
    for (Map.Entry<String, String> entry : response.getState().metaData().transientSettings().getAsMap().entrySet()) {
      builder.field(entry.getKey(), entry.getValue());
    }
    builder.endObject();

    builder.endObject();

    return builder;
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

for(Map.Entry<String,String> ent : metaData.persistentSettings().getAsMap().entrySet()) {
  String settingName = ent.getKey();
  String settingValue = ent.getValue();
    if (newPersistentSettings == null) {
      newPersistentSettings = Settings.builder();
      newPersistentSettings.put(metaData.persistentSettings());
    if (newPersistentSettings == null) {
      newPersistentSettings = Settings.builder();
      newPersistentSettings.put(metaData.persistentSettings());

代码示例来源:origin: harbby/presto-connectors

builder.field("cluster_uuid", metaData.clusterUUID);
if (!metaData.persistentSettings().getAsMap().isEmpty()) {
  builder.startObject("settings");
  for (Map.Entry<String, String> entry : metaData.persistentSettings().getAsMap().entrySet()) {
    builder.field(entry.getKey(), entry.getValue());

代码示例来源:origin: harbby/presto-connectors

private void restoreGlobalStateIfRequested(MetaData.Builder mdBuilder) {
  if (request.includeGlobalState()) {
    if (metaData.persistentSettings() != null) {
      boolean changed = false;
      Settings.Builder persistentSettings = Settings.settingsBuilder().put();
      for (Map.Entry<String, String> entry : metaData.persistentSettings().getAsMap().entrySet()) {
        if (dynamicSettings.isDynamicOrLoggingSetting(entry.getKey())) {
          String error = dynamicSettings.validateDynamicSetting(entry.getKey(), entry.getValue(), clusterService.state());

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

builder.field("cluster_uuid", metaData.clusterUUID);
if (!metaData.persistentSettings().isEmpty()) {
  builder.startObject("settings");
  for (Map.Entry<String, String> entry : metaData.persistentSettings().getAsMap().entrySet()) {
    builder.field(entry.getKey(), entry.getValue());

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

builder.field("cluster_uuid", metaData.clusterUUID);
if (!metaData.persistentSettings().isEmpty()) {
  builder.startObject("settings");
  metaData.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
  builder.endObject();

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

@After
@Override
public void tearDown() throws Exception {
  logger.info("[{}#{}]: cleaning up after test", getTestClass().getSimpleName(), getTestName());
  try {
    DeleteIndexRequestBuilder builder = ElassandraDaemon.instance.node().client().admin().indices().prepareDelete("*");
    assertAcked(builder.get());
    MetaData metaData = client().admin().cluster().prepareState().get().getState().getMetaData();
    assertThat("test leaves persistent cluster metadata behind: " + metaData.persistentSettings().getAsGroups(),
        metaData.persistentSettings().size(), equalTo(0));
    assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().getAsGroups(),
        metaData.transientSettings().size(), equalTo(0));
    List<String> userKeyspaces = Schema.instance.getUserKeyspaces();
    userKeyspaces.remove(this.clusterService().getElasticAdminKeyspaceName());
    assertThat("test leaves a user keyspace behind:" + userKeyspaces, userKeyspaces.size(), equalTo(0));
  } catch(Exception e) {
    logger.warn("[{}#{}]: failed to clean indices and metadata: error="+e, getTestClass().getSimpleName(), getTestName());
  } finally {
    testMutex.release();
    logger.info("[{}#{}]: released semaphore={}", getTestClass().getSimpleName(), getTestName(), testMutex.toString());
  }
  super.tearDown();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private void restoreGlobalStateIfRequested(MetaData.Builder mdBuilder) {
  if (request.includeGlobalState()) {
    if (metaData.persistentSettings() != null) {
      Settings settings = metaData.persistentSettings();
      clusterSettings.validateUpdate(settings);
      mdBuilder.persistentSettings(settings);
    }
    if (metaData.templates() != null) {
      // TODO: Should all existing templates be deleted first?
      for (ObjectCursor<IndexTemplateMetaData> cursor : metaData.templates().values()) {
        mdBuilder.put(cursor.value);
      }
    }
    if (metaData.customs() != null) {
      for (ObjectObjectCursor<String, MetaData.Custom> cursor : metaData.customs()) {
        if (!RepositoriesMetaData.TYPE.equals(cursor.key)) {
          // Don't restore repositories while we are working with them
          // TODO: Should we restore them at the end?
          mdBuilder.putCustom(cursor.key, cursor.value);
        }
      }
    }
  }
}

代码示例来源:origin: harbby/presto-connectors

persistentSettings.put(currentState.metaData().persistentSettings());
for (Map.Entry<String, String> entry : request.persistentSettings().getAsMap().entrySet()) {
  if (dynamicSettings.isDynamicOrLoggingSetting(entry.getKey())) {

代码示例来源:origin: harbby/presto-connectors

/** As of 2.0 we require units for time and byte-sized settings. This methods adds default units to any
 * persistent settings and template settings that don't specify a unit.
 **/
public static MetaData addDefaultUnitsIfNeeded(ESLogger logger, MetaData metaData) {
  Settings newPersistentSettings = addDefaultUnitsIfNeeded(
      CLUSTER_TIME_SETTINGS, CLUSTER_BYTES_SIZE_SETTINGS, logger, metaData.persistentSettings());
  ImmutableOpenMap<String, IndexTemplateMetaData> templates = updateTemplates(logger, metaData.getTemplates());
  if (newPersistentSettings != null || templates != null) {
    return new MetaData(
        metaData.clusterUUID(),
        metaData.version(),
        metaData.transientSettings(),
        MoreObjects.firstNonNull(newPersistentSettings, metaData.persistentSettings()),
        metaData.getIndices(),
        MoreObjects.firstNonNull(templates, metaData.getTemplates()),
        metaData.getCustoms(),
        metaData.concreteAllIndices(),
        metaData.concreteAllOpenIndices(),
        metaData.concreteAllClosedIndices(),
        metaData.getAliasAndIndexLookup());
  } else {
    // No changes:
    return metaData;
  }
}

代码示例来源:origin: apache/servicemix-bundles

static ClusterGetSettingsResponse response(
    final ClusterState state,
    final boolean renderDefaults,
    final SettingsFilter settingsFilter,
    final ClusterSettings clusterSettings,
    final Settings settings) {
  return new ClusterGetSettingsResponse(
      settingsFilter.filter(state.metaData().persistentSettings()),
      settingsFilter.filter(state.metaData().transientSettings()),
      renderDefaults ? settingsFilter.filter(clusterSettings.diff(state.metaData().settings(), settings)) : Settings.EMPTY);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

static ClusterGetSettingsResponse response(
    final ClusterState state,
    final boolean renderDefaults,
    final SettingsFilter settingsFilter,
    final ClusterSettings clusterSettings,
    final Settings settings) {
  return new ClusterGetSettingsResponse(
      settingsFilter.filter(state.metaData().persistentSettings()),
      settingsFilter.filter(state.metaData().transientSettings()),
      renderDefaults ? settingsFilter.filter(clusterSettings.diff(state.metaData().settings(), settings)) : Settings.EMPTY);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

persistentSettings.put(currentState.metaData().persistentSettings());
changed |= clusterSettings.updateDynamicSettings(persistentToApply, persistentSettings, persistentUpdates, "persistent");

相关文章