refresh index only if user script is ran

This commit is contained in:
simon987 2020-06-25 20:48:47 -04:00
parent 8ffe780ab2
commit 7e92d4b7d1

View File

@ -261,16 +261,21 @@ void destroy_indexer(char *script, char index_id[UUID_STR_LEN]) {
char url[4096];
if (script != NULL) {
execute_update_script(script, index_id);
free(script);
}
snprintf(url, sizeof(url), "%s/sist2/_refresh", IndexCtx.es_url);
response_t *r = web_post(url, "");
LOG_INFOF("elastic.c", "Refresh index <%d>", r->status_code);
free_response(r);
if (script != NULL) {
execute_update_script(script, index_id);
free(script);
snprintf(url, sizeof(url), "%s/sist2/_refresh", IndexCtx.es_url);
r = web_post(url, "");
LOG_INFOF("elastic.c", "Refresh index <%d>", r->status_code);
free_response(r);
}
snprintf(url, sizeof(url), "%s/sist2/_forcemerge", IndexCtx.es_url);
r = web_post(url, "");
LOG_INFOF("elastic.c", "Merge index <%d>", r->status_code);