parent
3f8c1ca1d3
commit
b269eb7cce
@ -0,0 +1,45 @@
|
||||
package org.xbib.elx.http.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.CheckedFunction;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.xbib.elx.http.HttpAction;
|
||||
import org.xbib.net.http.client.HttpResponse;
|
||||
import org.xbib.net.http.client.netty.HttpRequestBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class HttpCloseIndexAction extends HttpAction<CloseIndexRequest, CloseIndexResponse> {
|
||||
|
||||
@Override
|
||||
public CloseIndexAction getActionInstance() {
|
||||
return CloseIndexAction.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HttpRequestBuilder createHttpRequest(String url, CloseIndexRequest closeIndexRequest) {
|
||||
return newPostRequest(url, "/" + String.join(",", closeIndexRequest.indices()) + "/_close");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CheckedFunction<XContentParser, CloseIndexResponse, IOException> entityParser(HttpResponse httpResponse) {
|
||||
return this::fromXContent;
|
||||
}
|
||||
|
||||
public CloseIndexResponse fromXContent(XContentParser parser) throws IOException {
|
||||
AcknowledgedResponse acknowledgedResponse = CloseIndexResponse.fromXContent(parser);
|
||||
if (parser.currentToken() == null) {
|
||||
parser.nextToken();
|
||||
}
|
||||
boolean shardAcknowledged = true;
|
||||
List<CloseIndexResponse.IndexResult> list = new LinkedList<>();
|
||||
return new CloseIndexResponse(acknowledgedResponse.isAcknowledged(), shardAcknowledged, list);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package org.xbib.elx.http.action.admin.indices.open;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
import org.elasticsearch.common.CheckedFunction;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.xbib.elx.http.HttpAction;
|
||||
import org.xbib.net.http.client.HttpResponse;
|
||||
import org.xbib.net.http.client.netty.HttpRequestBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HttpOpenIndexAction extends HttpAction<OpenIndexRequest, OpenIndexResponse> {
|
||||
|
||||
@Override
|
||||
public OpenIndexAction getActionInstance() {
|
||||
return OpenIndexAction.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HttpRequestBuilder createHttpRequest(String url, OpenIndexRequest openIndexRequest) {
|
||||
return newPostRequest(url, "/" + String.join(",", openIndexRequest.indices()) + "/_open");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CheckedFunction<XContentParser, OpenIndexResponse, IOException> entityParser(HttpResponse httpResponse) {
|
||||
return OpenIndexResponse::fromXContent;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
group = org.xbib
|
||||
name = elx
|
||||
version = 7.10.2.25
|
||||
version = 7.10.2.26
|
||||
|
||||
org.gradle.warning.mode = ALL
|
||||
|
Loading…
Reference in New Issue