From 886fa720ecde90afcc151e7d6818c00511f94879 Mon Sep 17 00:00:00 2001 From: simon987 Date: Fri, 14 Apr 2023 21:48:29 -0400 Subject: [PATCH] Fix for ES 8.X #302 --- scripts/start_dev_es_8.sh | 2 +- src/main.c | 5 ++++- src/sist.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/start_dev_es_8.sh b/scripts/start_dev_es_8.sh index 0517a0d..e8f7e26 100755 --- a/scripts/start_dev_es_8.sh +++ b/scripts/start_dev_es_8.sh @@ -1,3 +1,3 @@ docker run --rm -it --name "sist2-dev-es"\ -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" \ - -e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:8.1.2 + -e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:8.7.0 diff --git a/src/main.c b/src/main.c index 3099b73..ad44e72 100644 --- a/src/main.c +++ b/src/main.c @@ -312,7 +312,10 @@ void sist2_index(index_args_t *args) { database_open(db); database_iterator_t *iterator = database_create_document_iterator(db); database_document_iter_foreach(json, iterator) { - const char *doc_id = cJSON_GetObjectItem(json, "_id")->valuestring; + char doc_id[SIST_DOC_ID_LEN]; + strcpy(doc_id, cJSON_GetObjectItem(json, "_id")->valuestring); + cJSON_DeleteItemFromObject(json, "_id"); + if (args->print) { print_json(json, doc_id); } else { diff --git a/src/sist.h b/src/sist.h index 28aa580..31e04c5 100644 --- a/src/sist.h +++ b/src/sist.h @@ -51,7 +51,7 @@ #include #include "git_hash.h" -#define VERSION "3.0.1" +#define VERSION "3.0.2" static const char *const Version = VERSION; static const int VersionMajor = 3; static const int VersionMinor = 0;