Package org.elasticsearch.cluster.metadata

Examples of org.elasticsearch.cluster.metadata.AliasAction


                            }
                            if (alias == null) {
                                throw new ElasticSearchIllegalArgumentException("Alias action [" + action + "] requires an [alias] to be set");
                            }
                            if (type == AliasAction.Type.ADD) {
                                AliasAction aliasAction = newAddAliasAction(index, alias).filter(filter);
                                if (routingSet) {
                                    aliasAction.routing(routing);
                                }
                                if (indexRoutingSet) {
                                    aliasAction.indexRouting(indexRouting);
                                }
                                if (searchRoutingSet) {
                                    aliasAction.searchRouting(searchRouting);
                                }
                                indicesAliasesRequest.addAliasAction(aliasAction);
                            } else if (type == AliasAction.Type.REMOVE) {
                                indicesAliasesRequest.removeAlias(index, alias);
                            }
View Full Code Here


                            }
                            if (alias == null) {
                                throw new ElasticSearchIllegalArgumentException("Alias action [" + action + "] requires an [alias] to be set");
                            }
                            if (type == AliasAction.Type.ADD) {
                                AliasAction aliasAction = newAddAliasAction(index, alias).filter(filter);
                                if (routingSet) {
                                    aliasAction.routing(routing);
                                }
                                if (indexRoutingSet) {
                                    aliasAction.indexRouting(indexRouting);
                                }
                                if (searchRoutingSet) {
                                    aliasAction.searchRouting(searchRouting);
                                }
                                indicesAliasesRequest.addAliasAction(aliasAction);
                            } else if (type == AliasAction.Type.REMOVE) {
                                indicesAliasesRequest.removeAlias(index, alias);
                            }
View Full Code Here

   * @param alias the alias
   * @param setRouting if true will route by appid (alias)
   * @return true if acknowledged
   */
  public static boolean addIndexAlias(String indexName, String alias, boolean setRouting) {
    AliasAction act = new AliasAction(AliasAction.Type.ADD, indexName, alias);
    if (setRouting) {
      act.routing(alias);
      act.filter(FilterBuilders.termFilter(Config._APPID, alias));
    }
    return getClient().admin().indices().prepareAliases().addAliasAction(act).
        execute().actionGet().isAcknowledged();
  }
View Full Code Here

  @Override
  public Boolean addAlias(AliasQuery query) {
    Assert.notNull(query.getIndexName(), "No index defined for Alias");
    Assert.notNull(query.getAliasName(), "No alias defined");
    AliasAction aliasAction = new AliasAction(ADD, query.getIndexName(), query.getAliasName());
    if (query.getFilterBuilder() != null) {
      aliasAction.filter(query.getFilterBuilder());
    } else if (query.getFilter() != null) {
      aliasAction.filter(query.getFilter());
    } else if (isNotBlank(query.getRouting())) {
      aliasAction.routing(query.getRouting());
    } else if (isNotBlank(query.getSearchRouting())) {
      aliasAction.searchRouting(query.getSearchRouting());
    } else if (isNotBlank(query.getIndexRouting())) {
      aliasAction.indexRouting(query.getIndexRouting());
    }
    return client.admin().indices().prepareAliases().addAliasAction(aliasAction).execute().actionGet().isAcknowledged();
  }
View Full Code Here

   * @param alias the alias
   * @param setRouting if true will route by appid (alias)
   * @return true if acknowledged
   */
  public static boolean addIndexAlias(String indexName, String alias, boolean setRouting) {
    AliasAction act = new AliasAction(AliasAction.Type.ADD, indexName, alias);
    if (setRouting) {
      act.routing(alias);
      act.filter(FilterBuilders.termFilter(Config._APPID, alias));
    }
    return getClient().admin().indices().prepareAliases().addAliasAction(act).
        execute().actionGet().isAcknowledged();
  }
View Full Code Here

                                    }
                                }
                            }

                            if (type == AliasAction.Type.ADD) {
                                AliasAction aliasAction = newAddAliasAction(index, alias).filter(filter);
                                if (routingSet) {
                                    aliasAction.routing(routing);
                                }
                                if (indexRoutingSet) {
                                    aliasAction.indexRouting(indexRouting);
                                }
                                if (searchRoutingSet) {
                                    aliasAction.searchRouting(searchRouting);
                                }
                                indicesAliasesRequest.addAliasAction(aliasAction);
                            } else if (type == AliasAction.Type.REMOVE) {
                                indicesAliasesRequest.removeAlias(index, alias);
                            }
View Full Code Here

                .addAlias("bazbar", "bar")
                .addAlias("bazbar", "bac", termFilter("field", "value"))
                .addAlias("foobar", "foo"));

        assertAcked(admin().indices().prepareAliases()
                .addAliasAction(new AliasAction(AliasAction.Type.ADD, "foobar", "bac").routing("bla")));

        logger.info("--> getting bar and baz for index bazbar");
        getResponse = admin().indices().prepareGetAliases("bar", "bac").addIndices("bazbar").get();
        assertThat(getResponse, notNullValue());
        assertThat(getResponse.getAliases().size(), equalTo(1));
View Full Code Here

            for (String alias : action.aliases()) {
                aliases.add(alias);
            }
            for (String index : concreteIndices) {
                for (String alias : action.concreteAliases(state.metaData(), index)) {
                    AliasAction finalAction = new AliasAction(action.aliasAction());
                    finalAction.index(index);
                    finalAction.alias(alias);
                    finalActions.add(finalAction);
                    //if there is only delete requests, none will be added if the types do not map to any existing type
                    hasOnlyDeletesButNoneCanBeDone = false;
                }
            }
View Full Code Here

        private String[] indices = Strings.EMPTY_ARRAY;
        private String[] aliases = Strings.EMPTY_ARRAY;
        private AliasAction aliasAction;
       
        public AliasActions(AliasAction.Type type, String[] indices, String[] aliases) {
            aliasAction = new AliasAction(type);
            indices(indices);
            aliases(aliases);
        }
View Full Code Here

            indices(indices);
            aliases(aliases);
        }
       
        public AliasActions(AliasAction.Type type, String index, String alias) {
            aliasAction = new AliasAction(type);
            indices(index);
            aliases(alias);
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.cluster.metadata.AliasAction

Copyright © 2018 www.massapicom. 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.