脚本批量导入导出es表结构

批量导出

bash 复制代码
#使用脚本导出ElasticSearch所有mapping
for index in $(curl -u elastic:elastic -XGET 'http://192.168.100.110:9200/_cat/indices?v' | awk '{print $3}' | grep -vE '\.(kibana|tasks|operations)\b'); do
  curl  -u elastic:elastic -XGET "http://192.168.100.110:9200/$index/_mapping" > "$index.json"
done

批量导入(需要elasticdump)

默认会创建五个分片,一个副本

bash 复制代码
#!/bin/sh
for index in $(ls /home/esdump/data/es_mapping |grep .json); do
  without=$(echo $index | sed 's/\.json//')
#  echo $without
#  echo $index
  /home/esdump/node_modules/elasticdump/bin/elasticdump --input="/home/esdump/data/es_mapping/$index" --output=http://192.168.100.90:9200/${without}  --type=mapping
done
相关推荐
专业程序开发源6 小时前
SSM校园拍摄交流服务平台36936-计算机课程设计、毕业设计
java·spring boot·后端·python·elasticsearch·php·课程设计
vx_Biye_Design9 小时前
springboot宠物寄养服务预约与监管系统82684-计算机课程设计、毕业设计
java·vue.js·spring boot·elasticsearch·课程设计·express·宠物
Elastic 中国社区官方博客10 小时前
错误最多的服务运行正常:使用 ES|QL 从日志进行根因分析
大数据·运维·数据库·sql·elasticsearch·搜索引擎·全文检索
yukai080081 天前
【203篇系列】056 我的Agent系统
大数据·elasticsearch·搜索引擎
IT大白鼠1 天前
搜索系列 · 第 08 篇——面试收官:高频题与全景总结
elasticsearch·面试·nosql
光影少年1 天前
langchain与langgraph区别以及学习路线
elasticsearch·langchain·llm
Elasticsearch1 天前
错误最多的服务运行正常:使用 ES|QL 从日志进行根因分析
elasticsearch
Elasticsearch1 天前
将你自己的密钥用于现有 Elastic Cloud 部署
elasticsearch
IT大白鼠2 天前
搜索系列 · 第 06 篇——避坑汇总:经典生产问题
elasticsearch·nosql
IT大白鼠2 天前
搜索系列 · 第 07 篇——调优实战:写入、查询与监控
elasticsearch·nosql