Search in sources :

Example 1 with MultiPercolateRequest

use of org.elasticsearch.action.percolate.MultiPercolateRequest in project LinkAgent by shulieTech.

the class MultiPercolateRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    MultiPercolateRequest mReq = (MultiPercolateRequest) target;
    List list = mReq.requests();
    List<String> indexes = new ArrayList<String>();
    for (Object req : list) {
        if (req == null) {
            continue;
        }
        RequestIndexRename requestIndexRename = RequestIndexRenameProvider.get(req);
        if (requestIndexRename != null) {
            indexes.addAll(requestIndexRename.reindex(req));
        } else {
            throw new PressureMeasureError("elasticsearch " + req.getClass().getName() + " is not supported!");
        }
    }
    String[] indices = mReq.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 refresh business index ! " + index);
        }
        if (!Pradar.isClusterTestPrefix(index)) {
            index = Pradar.addClusterTestPrefixLower(index);
            indices[i] = index;
        }
    }
    return indexes;
}
Also used : MultiPercolateRequest(org.elasticsearch.action.percolate.MultiPercolateRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) ArrayList(java.util.ArrayList) RequestIndexRename(com.pamirs.attach.plugin.es.common.RequestIndexRename) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with MultiPercolateRequest

use of org.elasticsearch.action.percolate.MultiPercolateRequest in project LinkAgent by shulieTech.

the class MultiPercolateRequestIndexRename method getIndex0.

@Override
public List<String> getIndex0(Object target) {
    MultiPercolateRequest mReq = (MultiPercolateRequest) target;
    List list = mReq.requests();
    List<String> indexes = new ArrayList<String>();
    for (Object req : list) {
        if (req == null) {
            continue;
        }
        RequestIndexRename requestIndexRename = RequestIndexRenameProvider.get(req);
        if (requestIndexRename != null) {
            indexes.addAll(requestIndexRename.getIndex(req));
        }
    }
    return indexes;
}
Also used : MultiPercolateRequest(org.elasticsearch.action.percolate.MultiPercolateRequest) ArrayList(java.util.ArrayList) RequestIndexRename(com.pamirs.attach.plugin.es.common.RequestIndexRename) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

RequestIndexRename (com.pamirs.attach.plugin.es.common.RequestIndexRename)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 MultiPercolateRequest (org.elasticsearch.action.percolate.MultiPercolateRequest)2 PressureMeasureError (com.pamirs.pradar.exception.PressureMeasureError)1