脚本批量导入导出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
相关推荐
G皮T3 分钟前
【Elasticsearch】映射:null_value 详解
大数据·elasticsearch·搜索引擎·映射·mappings·null_value
Elasticsearch1 天前
ES8 向量功能窥探系列(二):向量数据的存储与优化
elasticsearch
安审若无1 天前
Elasticsearch中的监控(Monitoring)功能介绍
elasticsearch·搜索引擎·全文检索
leo_hush1 天前
elasticsearch基本操作笔记
elasticsearch
咸鱼求放生2 天前
es在Linux安装
大数据·elasticsearch·搜索引擎
xyhshen2 天前
k8s下离线搭建elasticsearch
elasticsearch·容器·kubernetes
@泽栖2 天前
ES数据聚合
elasticsearch·搜索引擎
張萠飛2 天前
Linux下如何使用shell脚本导出elasticsearch中某一个index的数据为本地csv文件
linux·运维·elasticsearch
LanLance2 天前
ES101系列09 | 运维、监控与性能优化
java·运维·后端·elasticsearch·云原生·性能优化·golang
疯狂的沙粒2 天前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch