Search in sources :

Example 1 with CloseIndexRequest

use of org.elasticsearch.client.indices.CloseIndexRequest in project LinkAgent by shulieTech.

the class CloseIndexRequestIndexRename0 method reindex0.

@Override
public List<String> reindex0(Object target) {
    CloseIndexRequest req = (CloseIndexRequest) target;
    String[] indexes = req.indices();
    for (int i = 0, len = indexes.length; i < len; i++) {
        String index = indexes[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);
            indexes[i] = index;
        }
    }
    try {
        Reflect.on(req).set("indices", indexes);
    } catch (ReflectException e) {
        throw new PressureMeasureError("can't found field indices from " + CloseIndexRequest.class.getName());
    }
    return Arrays.asList(indexes);
}
Also used : CloseIndexRequest(org.elasticsearch.client.indices.CloseIndexRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) ReflectException(com.shulie.instrument.simulator.api.reflect.ReflectException)

Example 2 with CloseIndexRequest

use of org.elasticsearch.client.indices.CloseIndexRequest in project graylog2-server by Graylog2.

the class ClientES7 method closeIndex.

@Override
public void closeIndex(String index) {
    final CloseIndexRequest closeIndexRequest = new CloseIndexRequest(index);
    client.execute((c, requestOptions) -> c.indices().close(closeIndexRequest, requestOptions));
}
Also used : CloseIndexRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.CloseIndexRequest)

Example 3 with CloseIndexRequest

use of org.elasticsearch.client.indices.CloseIndexRequest in project graylog2-server by Graylog2.

the class IndicesAdapterES7 method close.

@Override
public void close(String index) {
    final CloseIndexRequest request = new CloseIndexRequest(index);
    client.execute((c, requestOptions) -> c.indices().close(request, requestOptions), "Unable to close index " + index);
}
Also used : CloseIndexRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.CloseIndexRequest)

Aggregations

CloseIndexRequest (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.CloseIndexRequest)2 PressureMeasureError (com.pamirs.pradar.exception.PressureMeasureError)1 ReflectException (com.shulie.instrument.simulator.api.reflect.ReflectException)1 CloseIndexRequest (org.elasticsearch.client.indices.CloseIndexRequest)1