脚本批量导入导出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
相关推荐
流量猎手18 小时前
GitHub 使用说明
大数据·elasticsearch·github
Elasticsearch20 小时前
快 56%,检索性能最高提升 50%: Jina 全新 6 亿参数列表式重排序模型 reranker 内部揭秘
elasticsearch
倒流时光三十年21 小时前
第一阶段 01.Elasticsearch 核心概念与 PostgreSQL 对照
大数据·elasticsearch·postgresql
范什么特西21 小时前
Elasticsearch基本命令
大数据·elasticsearch·搜索引擎
大白菜和MySQL1 天前
elk部署和kibana图形化展示
java·笔记·elasticsearch
阿标在干嘛1 天前
政策快报平台全文检索的3次升级:从ES到向量检索
大数据·elasticsearch·全文检索
阿里云大数据AI技术2 天前
阿里云 Elasticsearch 9.4 Agent Builder 实战
人工智能·elasticsearch·agent
暖和_白开水2 天前
数据分析agent(九-2):es启动补充
大数据·elasticsearch·搜索引擎
海兰2 天前
基于 ES|QL 的 Kubernetes 监控工具箱:使用 ES|QL 进行 Kubernetes 监控,从内存压力到错误日志
大数据·elasticsearch·kubernetes