* @param alias The alias
* @param filter The filter
*/
public IndicesAliasesRequest addAlias(String index, String alias, Map<String, Object> filter) {
if (filter == null || filter.isEmpty()) {
aliasActions.add(new AliasAction(AliasAction.Type.ADD, index, alias));
return this;
}
try {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(filter);
aliasActions.add(new AliasAction(AliasAction.Type.ADD, index, alias, builder.string()));
return this;
} catch (IOException e) {
throw new ElasticSearchGenerationException("Failed to generate [" + filter + "]", e);
}
}