You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将MySQL接入Docker部署的Amundsen Lyft并解决ES映射报错

问题根因

报错由版本不兼容直接导致:你部署的Elasticsearch 8.0.0已正式移除索引mapping中自定义文档类型(doc type)的支持,而Amundsen官方示例脚本内置的ES索引创建逻辑是为ES 7.x版本编写的,创建索引时会传入名为table的自定义文档类型定义,ES 8.x无法识别该参数,直接抛出mapper解析异常。

修复方案
  • 快速验证方案(推荐PoC阶段使用):将Elasticsearch实例降级为7.17.x稳定版(Amundsen全组件官方适配版本),替换ES8实例后无需修改任何脚本代码,重新执行元数据加载流程即可正常对接。
  • 保留ES8版本的代码适配方案:
    1. 清理ES中之前创建失败的残留索引,避免配置冲突:
    curl -XDELETE http://localhost:9200/table_search_index
    
    1. 修改脚本中Elasticsearch客户端初始化逻辑,适配Docker部署的无认证ES8实例配置:
    es = Elasticsearch([
        {'host': es_host or 'localhost'},
    ], verify_certs=False, ssl_show_warn=False)
    
    1. 在脚本中新增ES8兼容的索引mapping定义,移除外层包裹的自定义文档类型字段:
    ES8_COMPATIBLE_TABLE_MAPPING = '''
    {
      "properties": {
        "schema": {"analyzer": "simple", "type": "text", "fields": {"raw": {"type": "keyword"}}},
        "cluster": {"type": "text"},
        "description": {"analyzer": "simple", "type": "text"},
        "display_name": {"type": "keyword"},
        "column_descriptions": {"analyzer": "simple", "type": "text"},
        "programmatic_descriptions": {"analyzer": "simple", "type": "text"},
        "tags": {"type": "keyword"},
        "badges": {"type": "keyword"},
        "database": {"analyzer": "simple", "type": "text", "fields": {"raw": {"type": "keyword"}}},
        "total_usage": {"type": "long"},
        "name": {"analyzer": "simple", "type": "text", "fields": {"raw": {"type": "keyword"}}},
        "last_updated_timestamp": {"format": "epoch_second", "type": "date"},
        "unique_usage": {"type": "long"},
        "column_names": {"analyzer": "simple", "type": "text", "fields": {"raw": {"type": "keyword"}}},
        "key": {"type": "keyword"}
      }
    }
    '''
    
    1. 修改ES索引发布任务的调用参数,传入自定义兼容mapping,同时将文档类型设置为ES8默认的_doc:
    job_es_table = create_es_publisher_sample_job(
        elasticsearch_index_alias='table_search_index',
        elasticsearch_doc_type_key='_doc',
        model_name='databuilder.models.table_elasticsearch_document.TableESDocument',
        elasticsearch_mapping=ES8_COMPATIBLE_TABLE_MAPPING
    )
    
    修改完成后重新执行脚本即可完成MySQL元数据接入。

注意:如果后续需要接入用户、仪表盘等其他类型的元数据索引,参照同样逻辑修改对应索引的mapping定义、传入_doc作为文档类型即可。

内容的提问来源于stack exchange,提问作者Locco

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.28 12:39:22