|
@@ -373,8 +373,7 @@ public class FessEsClient implements Client {
|
|
public boolean reindex(final String fromIndex, final String toIndex, final boolean waitForCompletion) {
|
|
public boolean reindex(final String fromIndex, final String toIndex, final boolean waitForCompletion) {
|
|
final String source = "{\"source\":{\"index\":\"" + fromIndex + "\"},\"dest\":{\"index\":\"" + toIndex + "\"}}";
|
|
final String source = "{\"source\":{\"index\":\"" + fromIndex + "\"},\"dest\":{\"index\":\"" + toIndex + "\"}}";
|
|
try (CurlResponse response =
|
|
try (CurlResponse response =
|
|
- Curl.post(org.codelibs.fess.util.ResourceUtil.getElasticsearchHttpUrl() + "/_reindex")
|
|
|
|
- .header("Content-Type", "application/json").param("wait_for_completion", Boolean.toString(waitForCompletion))
|
|
|
|
|
|
+ ComponentUtil.getCurlHelper().post("/_reindex").param("wait_for_completion", Boolean.toString(waitForCompletion))
|
|
.body(source).execute()) {
|
|
.body(source).execute()) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
return true;
|
|
return true;
|
|
@@ -516,8 +515,7 @@ public class FessEsClient implements Client {
|
|
try {
|
|
try {
|
|
source = FileUtil.readUTF8(filePath);
|
|
source = FileUtil.readUTF8(filePath);
|
|
try (CurlResponse response =
|
|
try (CurlResponse response =
|
|
- Curl.post(org.codelibs.fess.util.ResourceUtil.getElasticsearchHttpUrl() + "/_configsync/file")
|
|
|
|
- .header("Content-Type", "application/json").param("path", path).body(source).execute()) {
|
|
|
|
|
|
+ ComponentUtil.getCurlHelper().post("/_configsync/file").param("path", path).body(source).execute()) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
logger.info("Register " + path + " to " + index);
|
|
logger.info("Register " + path + " to " + index);
|
|
} else {
|
|
} else {
|
|
@@ -532,9 +530,7 @@ public class FessEsClient implements Client {
|
|
logger.warn("Failed to register " + filePath, e);
|
|
logger.warn("Failed to register " + filePath, e);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- try (CurlResponse response =
|
|
|
|
- Curl.post(org.codelibs.fess.util.ResourceUtil.getElasticsearchHttpUrl() + "/_configsync/flush")
|
|
|
|
- .header("Content-Type", "application/json").execute()) {
|
|
|
|
|
|
+ try (CurlResponse response = ComponentUtil.getCurlHelper().post("/_configsync/flush").execute()) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
logger.info("Flushed config files.");
|
|
logger.info("Flushed config files.");
|
|
} else {
|
|
} else {
|
|
@@ -610,9 +606,7 @@ public class FessEsClient implements Client {
|
|
}
|
|
}
|
|
|
|
|
|
private void waitForConfigSyncStatus() {
|
|
private void waitForConfigSyncStatus() {
|
|
- try (CurlResponse response =
|
|
|
|
- Curl.get(org.codelibs.fess.util.ResourceUtil.getElasticsearchHttpUrl() + "/_configsync/wait")
|
|
|
|
- .header("Content-Type", "application/json").param("status", "green").execute()) {
|
|
|
|
|
|
+ try (CurlResponse response = ComponentUtil.getCurlHelper().get("/_configsync/wait").param("status", "green").execute()) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
if (response.getHttpStatusCode() == 200) {
|
|
logger.info("ConfigSync is ready.");
|
|
logger.info("ConfigSync is ready.");
|
|
} else {
|
|
} else {
|