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: try:
os_client.indices.get_index_template("training") os_client.indices.delete_index_template("training")
except NotFoundError: except NotFoundError:
os_client.indices.put_index_template( pass
name="training",
body={
"index_patterns": ["training_*"],
"template": {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
"refresh_interval": -1, os_client.indices.put_index_template(
"translog.flush_threshold_size": "2048MB", name="training",
"codec": "zstd_no_dict", body={
"replication.type": "SEGMENT" "index_patterns": ["training_*"],
} "template": {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
}, "refresh_interval": -1,
"mappings": { "translog.flush_threshold_size": "2048MB",
"dynamic": "strict", "codec": "zstd_no_dict",
"properties": { "replication.type": "SEGMENT"
"accessRights": { }
"type": "keyword"
}, },
"alternativeIdentifiers": { "mappings": {
"type": "object", "dynamic": "strict",
"properties": { "properties": {
"alternativeIdentifier": { "accessRights": {
"type": "object", "type": "keyword"
"properties": { },
"type": { "alternativeIdentifiers": {
"type": "keyword" "type": "object",
}, "properties": {
"value": { "alternativeIdentifier": {
"type": "keyword" "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: # try:
# os_client.indices.get_index_template("") # os_client.indices.get_index_template("")