""" Elasticsearch 动态模板映射 """ from typing import Dict, Any def get_dynamic_templates() -> Dict[str, Any]: """ 获取动态模板映射配置 参考:d:/project/work/ragflow_plugs/book/es_dynamic.md Returns: Dict[str, Any]: 动态模板映射配置 """ return { "dynamic_templates": [ { "int": { "match": "*_int", "mapping": { "store": True, "type": "integer" } } }, { "ulong": { "match": "*_ulong", "mapping": { "store": True, "type": "unsigned_long" } } }, { "long": { "match": "*_long", "mapping": { "store": True, "type": "long" } } }, { "short": { "match": "*_short", "mapping": { "store": True, "type": "short" } } }, { "numeric": { "match": "*_flt", "mapping": { "store": True, "type": "float" } } }, { "tks": { "match": "*_tks", "mapping": { "analyzer": "whitespace", "similarity": "scripted_sim", "store": True, "type": "text" } } }, { "ltks": { "match": "*_ltks", "mapping": { "analyzer": "whitespace", "store": True, "type": "text" } } }, { "kwd": { "match": "^(.*_(kwd|id|ids|uid|uids)|uid)$", "match_pattern": "regex", "mapping": { "similarity": "boolean", "store": True, "type": "keyword" } } }, { "dt": { "match": "^.*(_dt|_time|_at)$", "match_pattern": "regex", "mapping": { "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM-dd_HH:mm:ss", "store": True, "type": "date" } } }, { "nested": { "match": "*_nst", "mapping": { "type": "nested" } } }, { "object": { "match": "*_obj", "mapping": { "dynamic": True, "type": "object" } } }, { "string": { "match": "^.*_(with_weight|list)$", "match_pattern": "regex", "mapping": { "index": False, "store": True, "type": "text" } } }, { "rank_feature": { "match": "*_fea", "mapping": { "type": "rank_feature" } } }, { "rank_features": { "match": "*_feas", "mapping": { "type": "rank_features" } } }, { "dense_vector_512": { "match": "*_512_vec", "mapping": { "dims": 512, "index": True, "similarity": "cosine", "type": "dense_vector" } } }, { "dense_vector_768": { "match": "*_768_vec", "mapping": { "dims": 768, "index": True, "similarity": "cosine", "type": "dense_vector" } } }, { "dense_vector_1024": { "match": "*_1024_vec", "mapping": { "dims": 1024, "index": True, "similarity": "cosine", "type": "dense_vector" } } }, { "dense_vector_1536": { "match": "*_1536_vec", "mapping": { "dims": 1536, "index": True, "similarity": "cosine", "type": "dense_vector" } } }, { "binary": { "match": "*_bin", "mapping": { "type": "binary" } } } ], "date_detection": True }