脚本批量导入导出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
相关推荐
Hello.Reader1 小时前
Go-Elasticsearch v9 安装与版本兼容性
elasticsearch·golang·jenkins
mykyle4 小时前
Elasticsearch-ik分析器
大数据·elasticsearch·jenkins
Penge66613 小时前
Elasticsearch深度分页解决方案
elasticsearch
Penge66613 小时前
Elasticsearch match_phrase 查询 slop 参数详解文档
elasticsearch
Penge66613 小时前
Elasticsearch 中的 copy_to:一文掌握字段合并搜索的利器
elasticsearch
mykyle1 天前
Elasticsearch-8.17.0 centos7安装
大数据·elasticsearch·jenkins
躲在云朵里`1 天前
Git的使用
大数据·git·elasticsearch
Elasticsearch2 天前
Elastic 劳动力的生成式 AI:ElasticGPT 的幕后解析
elasticsearch
kong@react2 天前
docker安装 Elasticsearch、Kibana、IK 分词器
elasticsearch·docker·jenkins
Elasticsearch2 天前
LlamaIndex 和 Elasticsearch Rerankers:无与伦比的简洁
elasticsearch