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

如何手动创建CSV的Elasticsearch映射及索引模板?解决索引冲突

为CSV数据创建Elasticsearch索引模板的实操步骤

1. 清理已存在的冲突索引

因为你已创建movie1索引,先删除它避免后续操作冲突:

DELETE /movie1

2. 创建自定义索引模板

索引模板会在你创建新索引时自动应用预设映射规则,无需依赖Kibana的自动生成工具。执行以下命令创建模板(模板默认匹配所有以movie开头的索引,也可将index_patterns改为精确的movie1):

PUT _index_template/movie_template
{
  "index_patterns": ["movie*"],
  "template": {
    "mappings": {
      "properties": {
        "Actor Name": {
          "type": "text"
        },
        "Category": {
          "type": "text"
        },
        "Cinema Involved": {
          "type": "text"
        },
        "Expense of Operation": {
          "type": "text"
        },
        "Movie Description": {
          "type": "text"
        },
        "Movie ID": {
          "type": "text"
        },
        "Movie Length": {
          "type": "text"
        },
        "Movie Name": {
          "type": "text"
        },
        "Movie Origin": {
          "type": "text"
        },
        "Movie Release Date": {
          "type": "text"
        },
        "Movie Type": {
          "type": "text"
        }
      }
    }
  },
  "priority": 100
}
  • index_patterns:定义模板匹配的索引名称规则,movie*会覆盖所有以movie开头的索引
  • priority:设置模板优先级(数值越高优先级越高),确保自定义模板能覆盖系统默认模板

3. 上传CSV并指定索引名

在Kibana中上传CSV时:

  • 跳过file-data-visualizer的自动映射流程,直接选择手动指定索引
  • 输入索引名movie1,Elasticsearch会自动匹配你创建的movie_template模板,应用预设映射完成数据导入

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 02:34:50