Search in sources :

Example 1 with AliasChange

use of org.webpieces.elasticsearch.actions.AliasChange in project webpieces by deanhiller.

the class ElasticClient method createAlias.

public XFuture<Response> createAlias(String alias, String indexName) {
    Map<String, String> params = Collections.emptyMap();
    AliasChange addAlias = new AliasChange();
    addAlias.setIndex(indexName);
    addAlias.setAlias(alias);
    List<Action> actions = new ArrayList<Action>();
    actions.add(new Action(addAlias, true));
    AtomicActionList list = new AtomicActionList();
    list.setActions(actions);
    return performRequest("POST", "/_aliases", params, list);
}
Also used : Action(org.webpieces.elasticsearch.actions.Action) ArrayList(java.util.ArrayList) AtomicActionList(org.webpieces.elasticsearch.actions.AtomicActionList) AliasChange(org.webpieces.elasticsearch.actions.AliasChange)

Example 2 with AliasChange

use of org.webpieces.elasticsearch.actions.AliasChange in project webpieces by deanhiller.

the class ElasticClient method renameAlias.

public XFuture<Response> renameAlias(String previousIndex, String newIndex, String alias) {
    Map<String, String> params = Collections.emptyMap();
    AliasChange removeAlias = new AliasChange();
    removeAlias.setIndex(previousIndex);
    removeAlias.setAlias(alias);
    AliasChange addAlias = new AliasChange();
    addAlias.setIndex(newIndex);
    addAlias.setAlias(alias);
    List<Action> actions = new ArrayList<Action>();
    actions.add(new Action(removeAlias, false));
    actions.add(new Action(addAlias, true));
    AtomicActionList list = new AtomicActionList();
    list.setActions(actions);
    return performRequest("POST", "/_aliases", params, list);
}
Also used : Action(org.webpieces.elasticsearch.actions.Action) ArrayList(java.util.ArrayList) AtomicActionList(org.webpieces.elasticsearch.actions.AtomicActionList) AliasChange(org.webpieces.elasticsearch.actions.AliasChange)

Aggregations

ArrayList (java.util.ArrayList)2 Action (org.webpieces.elasticsearch.actions.Action)2 AliasChange (org.webpieces.elasticsearch.actions.AliasChange)2 AtomicActionList (org.webpieces.elasticsearch.actions.AtomicActionList)2