From 88076612b72768616df323326d147c99c99e443c Mon Sep 17 00:00:00 2001 From: Giambattista Bloisi Date: Sat, 27 Jul 2024 14:46:40 +0200 Subject: [PATCH] initial stage --- airflow/dags/init_opensearch_templates.py | 327 +++++++++++----------- 1 file changed, 162 insertions(+), 165 deletions(-) diff --git a/airflow/dags/init_opensearch_templates.py b/airflow/dags/init_opensearch_templates.py index 3ec1589..fc1697a 100644 --- a/airflow/dags/init_opensearch_templates.py +++ b/airflow/dags/init_opensearch_templates.py @@ -1172,179 +1172,176 @@ def init_opensearch(os_client: OpenSearch): }) try: - os_client.indices.get_index_template("services") + os_client.indices.delete_index_template("services") except NotFoundError: - os_client.indices.put_index_template( - name="services", - body={ - "index_patterns": ["services_*"], - "template": { - "settings": { - "index": { - "number_of_shards": 1, - "number_of_replicas": 0, + pass - "refresh_interval": -1, - "translog.flush_threshold_size": "2048MB", - "codec": "zstd_no_dict", - "replication.type": "SEGMENT" - } + os_client.indices.put_index_template( + name="services", + body={ + "index_patterns": ["services_*"], + "template": { + "settings": { + "index": { + "number_of_shards": 1, + "number_of_replicas": 0, - }, - "mappings": { - "dynamic": "strict", - "properties": { - "accessRestriction": { - "type": "keyword" - }, - "accessTypes": { - "type": "keyword" - }, - "access_modes": { - "type": "keyword" - }, - "category": { - "type": "object", - "properties": { - "category": { - "type": "keyword" - }, - "subcategory": { - "type": "keyword" - } + "refresh_interval": -1, + "translog.flush_threshold_size": "2048MB", + "codec": "zstd_no_dict", + "replication.type": "SEGMENT" + } + + }, + "mappings": { + "dynamic": "strict", + "properties": { + "accessRestriction": { + "type": "keyword" + }, + "accessTypes": { + "type": "keyword" + }, + "access_modes": { + "type": "keyword" + }, + "category": { + "type": "object", + "properties": { + "category": { + "type": "keyword" + }, + "subcategory": { + "type": "keyword" } - }, - "description": { - "type": "text" - }, - "domain": { - "type": "object", - "properties": { - "domain": { - "type": "keyword" - }, - "subdomain": { - "type": "keyword" - } - } - }, - "grantProjectNames": { - "type": "text" - }, - "helpdeskPage": { - "type": "text" - }, - "horizontal": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "interoperabilityGuidelines": { - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - }, - "type": "text" - }, - "language": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - }, - "type": "text" - }, - "orderType": { - "type": "keyword" - }, - "organization": { - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - }, - "type": "text" - }, - "pricing": { - "type": "text" - }, - "privacyPolicy": { - "type": "text" - }, - "providers": { - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - }, - "type": "text" - }, - "relatedPlatforms": { - "type": "keyword" - }, - "relatedResources": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "keyword": { - "path": "tags", - "type": "alias" - }, - "targetUsers": { - "type": "keyword" - }, - "termsOfUse": { - "type": "text" - }, - "thematic": { - "type": "boolean" - }, - "trl": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "useCases": { - "type": "object", - "properties": { - "useCase": { - "type": "object", - "properties": { - "useCaseName": { - "type": "keyword" - }, - "useCaseURL": { - "type": "text" - } - } - } - } - }, - "userManual": { - "type": "text" - }, - "webpage": { - "type": "text" - }, - "year": { - "type": "long" } + }, + "description": { + "type": "text" + }, + "domain": { + "type": "object", + "properties": { + "domain": { + "type": "keyword" + }, + "subdomain": { + "type": "keyword" + } + } + }, + "grantProjectNames": { + "type": "text" + }, + "helpdeskPage": { + "type": "text" + }, + "horizontal": { + "type": "boolean" + }, + "id": { + "type": "keyword" + }, + "interoperabilityGuidelines": { + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + }, + "type": "text" + }, + "language": { + "type": "keyword" + }, + "name": { + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + }, + "type": "text" + }, + "orderType": { + "type": "keyword" + }, + "organization": { + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + }, + "type": "text" + }, + "pricing": { + "type": "text" + }, + "privacyPolicy": { + "type": "text" + }, + "providers": { + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + }, + "type": "text" + }, + "relatedPlatforms": { + "type": "keyword" + }, + "relatedResources": { + "type": "keyword" + }, + "tags": { + "type": "keyword" + }, + "keyword": { + "path": "tags", + "type": "alias" + }, + "targetUsers": { + "type": "keyword" + }, + "termsOfUse": { + "type": "text" + }, + "thematic": { + "type": "boolean" + }, + "trl": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "useCases": { + "type": "object", + "properties": { + "useCaseName": { + "type": "keyword" + }, + "useCaseURL": { + "type": "text" + } + } + }, + "userManual": { + "type": "text" + }, + "webpage": { + "type": "text" + }, + "year": { + "type": "long" } } } - }) + } + }) try: os_client.indices.delete_index_template("training")