pat2vec.util.generate_elastic_schemaļ
Functions
|
Generates index schemas (mappings and settings) from the connected Elasticsearch cluster. |
- pat2vec.util.generate_elastic_schema.generate_schema_from_cluster(indices=None, output_file='elastic_schemas.json')[source]ļ
Generates index schemas (mappings and settings) from the connected Elasticsearch cluster.
This function retrieves the mappings and settings for specified indices from the live Elasticsearch instance connected via pat2vec.cs. It cleans the settings to make them suitable for creating new indices in a test environment (removing UUIDs, creation dates, etc.).
- Parameters:
indices (
Optional[List[str]]) ā List of index names or patterns to export. If None, defaults to the standard pat2vec indices: [āepr_documentsā, ābasic_observationsā, āobservationsā, āorderā, āpims_apps*ā].output_file (
str) ā Path to save the generated schema JSON.
- Return type:
Dict[str,Any]- Returns:
A dictionary where keys are the simplified index names (e.g., āpims_appsā instead of āpims_apps*ā) and values are dictionaries containing āmappingsā and āsettingsā.