From a8f0aef0cf2d9f7c1a35a863777c5e57408085a1 Mon Sep 17 00:00:00 2001 From: amdomanska Date: Tue, 19 Nov 2024 10:19:35 +0000 Subject: [PATCH] PR cleanup: revert changes in core.py --- portality/core.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/portality/core.py b/portality/core.py index 89d03707e..1c9a8cc6d 100644 --- a/portality/core.py +++ b/portality/core.py @@ -189,7 +189,7 @@ def create_es_connection(app): # return type -def put_mappings(conn, mappings, force_mappings=False): +def put_mappings(conn, mappings): # get the ES version that we're working with #es_version = app.config.get("ELASTIC_SEARCH_VERSION", "1.7.5") @@ -210,15 +210,10 @@ def put_mappings(conn, mappings, force_mappings=False): request_timeout=app.config.get("ES_SOCKET_TIMEOUT", None)) print("Creating ES Type + Mapping in index {0} for {1}; status: {2}".format(altered_key, key, r)) else: - if force_mappings: - r = conn.indices.put_mapping(index=altered_key, body=mapping.get("mappings"), - request_timeout=app.config.get("ES_SOCKET_TIMEOUT", None)) - print("Updating ES Type + Mapping in index {0} for {1}; status: {2}".format(altered_key, key, r)) - else: - print("ES Type + Mapping already exists in index {0} for {1}".format(altered_key, key)) + print("ES Type + Mapping already exists in index {0} for {1}".format(altered_key, key)) -def initialise_index(app, conn, only_mappings=None, force_mappings=False): +def initialise_index(app, conn, only_mappings=None): """ ~~InitialiseIndex:Framework->Elasticsearch:Technology~~ :param app: @@ -240,7 +235,7 @@ def initialise_index(app, conn, only_mappings=None, force_mappings=False): mappings = {key:value for (key, value) in mappings.items() if key in only_mappings} # Send the mappings to ES - put_mappings(conn, mappings, force_mappings) + put_mappings(conn, mappings) ################################################## @@ -344,4 +339,4 @@ def build_statics(app): app = create_app() -es_connection = create_es_connection(app) +es_connection = create_es_connection(app) \ No newline at end of file