initial stage

This commit is contained in:
Giambattista Bloisi 2024-07-27 14:43:00 +02:00
parent 47665d151e
commit 792d069234
1 changed files with 114 additions and 117 deletions

View File

@ -1347,133 +1347,130 @@ def init_opensearch(os_client: OpenSearch):
})
try:
os_client.indices.get_index_template("training")
os_client.indices.delete_index_template("training")
except NotFoundError:
os_client.indices.put_index_template(
name="training",
body={
"index_patterns": ["training_*"],
"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="training",
body={
"index_patterns": ["training_*"],
"template": {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
},
"mappings": {
"dynamic": "strict",
"properties": {
"accessRights": {
"type": "keyword"
},
"alternativeIdentifiers": {
"type": "object",
"properties": {
"alternativeIdentifier": {
"type": "object",
"properties": {
"type": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
"refresh_interval": -1,
"translog.flush_threshold_size": "2048MB",
"codec": "zstd_no_dict",
"replication.type": "SEGMENT"
}
},
"mappings": {
"dynamic": "strict",
"properties": {
"accessRights": {
"type": "keyword"
},
"alternativeIdentifiers": {
"type": "object",
"properties": {
"alternativeIdentifier": {
"type": "object",
"properties": {
"type": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
}
}
},
"authors": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"contentResourceType": {
"type": "keyword"
},
"description": {
"type": "text"
},
"domain": {
"type": "object",
"properties": {
"domain": {
"type": "keyword"
},
"subdomain": {
"type": "keyword"
}
}
},
"duration": {
"type": "keyword"
},
"expertiseLevel": {
"type": "keyword"
},
"id": {
"type": "keyword"
},
"keyword": {
"type": "keyword"
},
"language": {
"type": "keyword"
},
"learningOutcomes": {
"type": "object",
"properties": {
"learningOutcome": {
"type": "text"
}
}
},
"learningResourceType": {
"type": "keyword"
},
"license": {
"type": "keyword"
},
"organization": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"qualifications": {
"type": "keyword"
},
"targetGroup": {
"type": "keyword"
},
"title": {
"type": "text"
},
"type": {
"type": "keyword"
},
"url": {
"type": "text"
},
"year": {
"type": "long"
}
},
"authors": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"contentResourceType": {
"type": "keyword"
},
"description": {
"type": "text"
},
"domain": {
"type": "object",
"properties": {
"domain": {
"type": "keyword"
},
"subdomain": {
"type": "keyword"
}
}
},
"duration": {
"type": "keyword"
},
"expertiseLevel": {
"type": "keyword"
},
"id": {
"type": "keyword"
},
"keyword": {
"type": "keyword"
},
"language": {
"type": "keyword"
},
"learningOutcomes": {
"type": "text"
},
"learningResourceType": {
"type": "keyword"
},
"license": {
"type": "keyword"
},
"organization": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"qualifications": {
"type": "keyword"
},
"targetGroup": {
"type": "keyword"
},
"title": {
"type": "text"
},
"type": {
"type": "keyword"
},
"url": {
"type": "text"
},
"year": {
"type": "long"
}
}
}
})
}
})
# try:
# os_client.indices.get_index_template("")