mirror of
https://github.com/simon987/sist2.git
synced 2025-04-10 14:06:45 +00:00
Fix elasticsearch 6 bug
This commit is contained in:
parent
50fcec25f7
commit
cbb043f03f
@ -210,8 +210,11 @@ void elastic_init(int force_reset) {
|
||||
|
||||
cJSON *elastic_get_document(const char *uuid_str) {
|
||||
char url[4096];
|
||||
snprintf(url, 4096, "%s/sist2/_source/%s", WebCtx.es_url, uuid_str);
|
||||
snprintf(url, 4096, "%s/sist2/_doc/%s", WebCtx.es_url, uuid_str);
|
||||
|
||||
response_t *r = web_get(url);
|
||||
return cJSON_Parse(r->body);
|
||||
if (r->status_code == 200) {
|
||||
return cJSON_Parse(r->body);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||
|
||||
|
||||
static const char *const Version = "1.0.3";
|
||||
static const char *const Version = "1.0.4";
|
||||
static const char *const usage[] = {
|
||||
"sist2 scan [OPTION]... PATH",
|
||||
"sist2 index [OPTION]... INDEX",
|
||||
|
@ -337,11 +337,14 @@ int file(void *p, onion_request *req, onion_response *res) {
|
||||
return OCS_PROCESSED;
|
||||
}
|
||||
|
||||
cJSON *source = elastic_get_document(arg_uuid);
|
||||
cJSON *doc = elastic_get_document(arg_uuid);
|
||||
cJSON *source = cJSON_GetObjectItem(doc, "_source");
|
||||
cJSON *index_id = cJSON_GetObjectItem(source, "index");
|
||||
if (index_id == NULL) {
|
||||
return OCS_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
const char *index_id = cJSON_GetObjectItem(source, "index")->valuestring;
|
||||
|
||||
index_t *idx = get_index_by_id(index_id);
|
||||
index_t *idx = get_index_by_id(index_id->valuestring);
|
||||
|
||||
if (idx == NULL) {
|
||||
return OCS_NOT_PROCESSED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user