/** Saves the settings state after validating them. */
  public void save() {
    String resource = getTargetResource();
    String hosts = getTargetHosts();

    Assert.hasText(
        resource,
        String.format("No resource (index/query/location) ['%s'] specified", ES_RESOURCE));
    setProperty(INTERNAL_ES_TARGET_RESOURCE, resource);
    setProperty(INTERNAL_ES_HOSTS, hosts);
  }
  public static void setFilters(Settings settings, String... filters) {
    // clear any filters inside the settings
    settings.setProperty(InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS, "");

    if (ObjectUtils.isEmpty(filters)) {
      return;
    }

    settings.setProperty(
        InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS, IOUtils.serializeToBase64(filters));
  }
  /** Saves the settings state after validating them. */
  public void save() {
    String targetUri = getTargetUri();
    String resource = getTargetResource();

    Assert.hasText(targetUri, "No address specified");
    Assert.hasText(
        resource,
        String.format("No resource (index/query/location) ['%s'] specified", ES_RESOURCE));

    setProperty(INTERNAL_ES_TARGET_URI, targetUri);
    setProperty(INTERNAL_ES_TARGET_RESOURCE, resource);
  }
  static void fixHive13InvalidComments(Settings settings, Properties tbl) {
    if (Booleans.parseBoolean(settings.getProperty("es.hive.disable.columns.comments.fix"))) {
      return;
    }

    settings.setProperty(HiveConstants.COLUMN_COMMENTS, "");
    tbl.remove(HiveConstants.COLUMN_COMMENTS);
  }
  public Settings merge(Properties properties) {
    if (properties == null) {
      return this;
    }

    Enumeration<?> propertyNames = properties.propertyNames();

    Object prop = null;
    for (; propertyNames.hasMoreElements(); ) {
      prop = propertyNames.nextElement();
      if (prop instanceof String) {
        Object value = properties.get(prop);
        setProperty((String) prop, value.toString());
      }
    }

    return this;
  }
 public Settings cleanResource() {
   setProperty(INTERNAL_ES_TARGET_RESOURCE, "");
   return this;
 }
 public Settings cleanUri() {
   setProperty(INTERNAL_ES_TARGET_URI, "");
   return this;
 }
 public Settings setQuery(String query) {
   setProperty(ES_QUERY, query);
   return this;
 }
 private Resource createResource(String target) {
   Settings s = new TestSettings();
   s.setProperty(ConfigurationOptions.ES_RESOURCE, target);
   return new Resource(s, true);
 }
 public Settings cleanHosts() {
   setProperty(INTERNAL_ES_HOSTS, "");
   return this;
 }
 public static void setDiscoveredNodes(Settings settings, Collection<String> nodes) {
   settings.setProperty(
       InternalConfigurationOptions.INTERNAL_ES_DISCOVERED_NODES,
       StringUtils.concatenate(nodes, StringUtils.DEFAULT_DELIMITER));
 }
 public static void pinNode(Settings settings, String node, int port) {
   if (StringUtils.hasText(node) && port > 0) {
     settings.setProperty(
         InternalConfigurationOptions.INTERNAL_ES_PINNED_NODE, qualifyNode(node, port));
   }
 }