Search in sources :

Example 1 with ShardUpgradeRequest

use of org.elasticsearch.action.admin.indices.upgrade.post.ShardUpgradeRequest in project LinkAgent by shulieTech.

the class ShardUpgradeRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    ShardUpgradeRequest req = (ShardUpgradeRequest) target;
    String[] indices = req.indices();
    for (int i = 0, len = indices.length; i < len; i++) {
        String index = indices[i];
        /**
         * 如果在白名单中则不允许写
         */
        if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
            throw new PressureMeasureError("Cluster Test request can't delete index template ! " + index);
        }
        if (!Pradar.isClusterTestPrefix(index)) {
            index = Pradar.addClusterTestPrefixLower(index);
            indices[i] = index;
        }
    }
    return Arrays.asList(indices);
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) ShardUpgradeRequest(org.elasticsearch.action.admin.indices.upgrade.post.ShardUpgradeRequest)

Aggregations

PressureMeasureError (com.pamirs.pradar.exception.PressureMeasureError)1 ShardUpgradeRequest (org.elasticsearch.action.admin.indices.upgrade.post.ShardUpgradeRequest)1