Centos下安装elasticdump

yum install elasticdump

安装完成后

[root@i-vvxxxxswtw5ne ~]# elasticdump --help

elasticdump: Import and export tools for elasticsearch

version: 2.2.0

Usage: elasticdump --input SOURCE --output DESTINATION [OPTIONS]

--input

Source location (required)

--input-index

Source index and type

(default: all, example: index/type)

--output

Destination location (required)

--output-index

Destination index and type

(default: all, example: index/type)

--limit

How many objects to move in batch per operation

limit is approximate for file streams

(default: 100)

--debug

Display the elasticsearch commands being used

(default: false)

--type

What are we exporting?

(default: data, options: [data, mapping])

--delete

Delete documents one-by-one from the input as they are

moved. Will not delete the source index

(default: false)

--searchBody

Preform a partial extract based on search results

(when ES is the input,

(default: '{"query": { "match_all": {} } }'))

--sourceOnly

Output only the json contained within the document _source

Normal: {"_index":"","_type":"","_id":"", "_source":{SOURCE}}

sourceOnly: {SOURCE}

(default: false)

--all

Load/store documents from ALL indexes

(default: false)

--ignore-errors

Will continue the read/write loop on write error

(default: false)

--scrollTime

Time the nodes will hold the requested search in order.

(default: 10m)

--maxSockets

How many simultaneous HTTP requests can we process make?

(default:

5 [node <= v0.10.x] /

Infinity [node >= v0.11.x] )

--timeout

Integer containing the number of milliseconds to wait for

a request to respond before aborting the request. Passed

directly to the request library. Mostly used when you don't

care too much if you lose some data when importing

but rather have speed.

--offset

Integer containing the number of rows you wish to skip

ahead from the input transport. When importing a large

index, things can go wrong, be it connectivity, crashes,

someone forgetting to `screen`, etc. This allows you

to start the dump again from the last known line written

(as logged by the `offset` in the output). Please be

advised that since no sorting is specified when the

dump is initially created, there's no real way to

guarantee that the skipped rows have already been

written/parsed. This is more of an option for when

you want to get most data as possible in the index

without concern for losing some rows in the process,

similar to the `timeout` option.

--inputTransport

Provide a custom js file to us as the input transport

--outputTransport

Provide a custom js file to us as the output transport

--toLog

When using a custom outputTransport, should log lines

be appended to the output stream?

(default: true, except for `$`)

--help

This page

Examples:

# Copy an index from production to staging with mappings:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=http://staging.es.com:9200/my_index \

--type=mapping

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=http://staging.es.com:9200/my_index \

--type=data

# Backup index data to a file:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=/data/my_index_mapping.json \

--type=mapping

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=/data/my_index.json \

--type=data

# Backup and index to a gzip using stdout:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=$ \

| gzip > /data/my_index.json.gz

# Backup the results of a query to a file

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=query.json \

--searchBody '{"query":{"term":{"username": "admin"}}}'

Learn more @ https://github.com/taskrabbit/elasticsearch-dump

数据从一个库导入另一个库input和output都是url [root@i-vvwdddtw5ne ~]# elasticdump --input=http://192.192.16.50:9200/elasticsearch_sapdata --output=http://192.192.16.30:9200/elasticsearch_sapdata --type=data

Sun, 21 Jul 2019 06:44:18 GMT | starting dump

Sun, 21 Jul 2019 06:44:18 GMT | Error Emitted => {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400}

Sun, 21 Jul 2019 06:44:18 GMT | Total Writes: 0

Sun, 21 Jul 2019 06:44:18 GMT | dump ended with error (get phase) => Error: {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400}

解决办法:加上  --searchBody '{"query":{"match_all": {}}}'

#input 和output都指向库的url

[root@i-vvwtw5ne ~]# elasticdump --input=http://192.192.16.50:9200/elasticsearch_sapdata --output=http://192.192.16.30:9200/elasticsearch_sapdata --type=data --searchBody '{"query":{"match_all": {}}}'

Sun, 21 Jul 2019 06:49:57 GMT | starting dump

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 0)

Sun, 21 Jul 2019 06:49:57 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 100)

Sun, 21 Jul 2019 06:49:57 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 200)

Sun, 21 Jul 2019 06:49:57 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 300)

Sun, 21 Jul 2019 06:49:57 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 400)

Sun, 21 Jul 2019 06:49:57 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:57 GMT | got 100 objects from source elasticsearch (offset: 500)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 600)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 700)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 800)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 900)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 1000)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 1100)

Sun, 21 Jul 2019 06:49:58 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:58 GMT | got 100 objects from source elasticsearch (offset: 1200)

Sun, 21 Jul 2019 06:49:59 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:49:59 GMT | got 87 objects from source elasticsearch (offset: 1300)

Sun, 21 Jul 2019 06:49:59 GMT | sent 87 objects to destination elasticsearch, wrote 87

Sun, 21 Jul 2019 06:49:59 GMT | got 0 objects from source elasticsearch (offset: 1387)

Sun, 21 Jul 2019 06:49:59 GMT | Total Writes: 1387

Sun, 21 Jul 2019 06:49:59 GMT | dump complete

把一个文件导入到库中,input为文件,output为要导入的库

[root@i-vvwtw5ne ~]# elasticdump --input=gaopan.json --output=http://192.192.16.30:9200/elasticsearch_sapdata --type=data --searchBody '{"query":{"match_all": {}}}'

Sun, 21 Jul 2019 06:53:36 GMT | starting dump

Sun, 21 Jul 2019 06:53:36 GMT | got 100 objects from source file (offset: 0)

Sun, 21 Jul 2019 06:53:36 GMT | sent 100 objects to destination elasticsearch, wrote 100

Sun, 21 Jul 2019 06:53:37 GMT | got 137 objects from source file (offset: 100)

Sun, 21 Jul 2019 06:53:37 GMT | sent 137 objects to destination elasticsearch, wrote 137

Sun, 21 Jul 2019 06:53:37 GMT | got 141 objects from source file (offset: 237)

Sun, 21 Jul 2019 06:53:37 GMT | sent 141 objects to destination elasticsearch, wrote 141

Sun, 21 Jul 2019 06:53:37 GMT | got 132 objects from source file (offset: 378)

Sun, 21 Jul 2019 06:53:37 GMT | sent 132 objects to destination elasticsearch, wrote 132

Sun, 21 Jul 2019 06:53:37 GMT | got 143 objects from source file (offset: 510)

Sun, 21 Jul 2019 06:53:37 GMT | sent 143 objects to destination elasticsearch, wrote 143

Sun, 21 Jul 2019 06:53:37 GMT | got 132 objects from source file (offset: 653)

Sun, 21 Jul 2019 06:53:37 GMT | sent 132 objects to destination elasticsearch, wrote 132

Sun, 21 Jul 2019 06:53:37 GMT | got 140 objects from source file (offset: 785)

Sun, 21 Jul 2019 06:53:38 GMT | sent 140 objects to destination elasticsearch, wrote 140

Sun, 21 Jul 2019 06:53:38 GMT | got 131 objects from source file (offset: 925)

Sun, 21 Jul 2019 06:53:38 GMT | sent 131 objects to destination elasticsearch, wrote 131

Sun, 21 Jul 2019 06:53:38 GMT | got 143 objects from source file (offset: 1056)

Sun, 21 Jul 2019 06:53:38 GMT | sent 143 objects to destination elasticsearch, wrote 143

Sun, 21 Jul 2019 06:53:38 GMT | got 132 objects from source file (offset: 1199)

Sun, 21 Jul 2019 06:53:38 GMT | sent 132 objects to destination elasticsearch, wrote 132

Sun, 21 Jul 2019 06:53:38 GMT | got 56 objects from source file (offset: 1331)

Sun, 21 Jul 2019 06:53:38 GMT | sent 56 objects to destination elasticsearch, wrote 56

Sun, 21 Jul 2019 06:53:38 GMT | got 0 objects from source file (offset: 1387)

Sun, 21 Jul 2019 06:53:38 GMT | Total Writes: 1387

Sun, 21 Jul 2019 06:53:38 GMT | dump complete

把数据导出到json文件中(input为要导出的库,output为要导出的文件路径) [root@i-vvwtw5ne ~]# elasticdump --input=http://192.192.16.30:9200/elasticsearch_sapdata --output=gaopan2.json --type=data --searchBody '{"query":{"match_all": {}}}'

Sun, 21 Jul 2019 06:55:57 GMT | starting dump

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 0)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 100)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 200)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 300)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 400)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 500)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 600)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 700)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 800)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 900)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 1000)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 1100)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 100 objects from source elasticsearch (offset: 1200)

Sun, 21 Jul 2019 06:55:57 GMT | sent 100 objects to destination file, wrote 100

Sun, 21 Jul 2019 06:55:57 GMT | got 87 objects from source elasticsearch (offset: 1300)

Sun, 21 Jul 2019 06:55:57 GMT | sent 87 objects to destination file, wrote 87

Sun, 21 Jul 2019 06:55:57 GMT | got 0 objects from source elasticsearch (offset: 1387)

Sun, 21 Jul 2019 06:55:57 GMT | Total Writes: 1387

Sun, 21 Jul 2019 06:55:57 GMT | dump complete

java 导出es数据_elasticseach 数据的导出与导出工具elasticdump使用相关推荐

  1. elasticdump安装_elasticsearch导出、导入工具-elasticdump

    elasticsearch导出.导入工具-elasticdump elasticsearch 数据导入到本地,或本地数据导入到elasticsearch中,或集群间的数据迁移,可以用elasticse ...

  2. java怎么导入到安卓手机,android导入excel表格数据-随手记记账记录如何导出到EXCEL(安卓版)...

    excel数据导入到android项目下的sqlite数据库中 把excel的数据读入到程序里. 这个就是用java读取excel的数据,百度一下就有很多成熟的例子. 把程序的数据存入sqllite里 ...

  3. java利用freemarker导出含有list的数据到word,有demo可供下载

    java利用freemarker导出含有list的数据到word,有demo可供下载 前言 FreeMarker是一款模板引擎: 即一种基于模板和要改变的数据, 并用来生成输出文本(HTML网页.电子 ...

  4. Java中带图片的数据导出到excel

    Java中导入,导出带图片的数据及模板下载 数据导出 数据导出 导出包含了带图片的与不带图片的导出方式,大致如下: 无图片的导出 : 这种导出可以选择你喜欢用的,POI或者EasyExcel等,这里选 ...

  5. java 从excel中读取数据_在Java中读取Excel文件的内容和导出数据到Excel文件中

    转自www.chianjavaworld.net 原作者:SonyMusic 读:rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr 在Java ...

  6. Java导出Excel百万条数据表格数据实现分页easyexcel方法和Apach POI方法

    关闭程序的查询sql语句打印日志功能,否则速度很慢 注意: 此导出excel样式只是简单设置而已 1.创建实体类 ExcelModel 导出数据库对应实体数据列表 简单样式设计 MAVEN仓库依赖或者 ...

  7. Java,excel大量百万数据导出优化措施,SXSSFWorkbook流式、分批次导出示例

    在导出百万级的数据时,如果不采用适当的优化措施,确实可能会造成死机和内存崩溃等问题. 为避免这些问题,可以采用以下优化措施: 分批次读取数据:将需要导出的数据分成多个批次进行读取和写入,每次读取部分数 ...

  8. mysql11导入数据_MySQL专题11之MySQL导出数据、MySQL导入数据

    1.MySQL导出数据 -  MySQL中你可以使用SELECT...INTO OUTFILE语句来简单的导出数据到文本文件中. a.使用SELECT...INTO OUTFILE -  以下实例中我 ...

  9. Hive:命令行界面、数据类型、DDL数据定义(数据库及表操作/分区分桶)、DML数据操作(数据导入导出)

    目录 1.Hive命令行界面 1.1.选项列表 1.2.变量和属性 1.2.1.Hive中变量和属性命名空间 1.2.2.用户自定义变量 1.2.3..hiverc文件 1.3.一次使用的命令 1.4 ...

最新文章

  1. 库克:苹果收取 30% 佣金很合理!
  2. html版本的网站地图只适合,如何在HTML和XML网站地图中取舍
  3. 计算机应用基础中专教材pdf,中等职业教育通用教材-计算机应用基础.pdf
  4. 数据库原理与应用(SQL Server)笔记 第十章 用户定义函数
  5. cmstop中实例化controller_admin_content类传递$this,其构造方法中接收到的是--名为cmstop的参数--包含cmstop中所有属性...
  6. C语言经典编程题--哥德巴赫猜想 、完数 、猜数字等
  7. hdu3689(kmp+dp)
  8. SpaceX再获美国宇航局价值1.525亿美元合同
  9. Python高级知识点学习(一)
  10. 2017-2018-1 20155315 《信息安全系统设计基础》第11周学习总结
  11. Atitit 性能指标与性能提升的5个原则与性能提升模型
  12. 算法与数据结构1800题
  13. matlab简单函数画图例题,Matlab(十) 简单的函数画图
  14. Signature Pad 使用
  15. CAD如何绘制六连环图案?CAD使用圆,椭圆,直线综合练习
  16. 分析方法选讲期末复习脉络图---完结版
  17. 微信开发者工具整个是个浏览器
  18. 转帖-在Eclipse中开发JSF
  19. javascript/html breakout game 打砖块游戏(附代码)
  20. 弗洛伊德求最小简单环

热门文章

  1. 从开源爱好者到 Apache 董事,他花了 11 年
  2. Windows、Linux 纷纷被爆漏洞,黑客可直取 root 权限!
  3. 远看像乱序执行,近看是内存屏障的BUG是如何解决的?
  4. 进退两难的硅谷程序员们
  5. Linux 内核中用 GFP_ATOMIC 申请内存究竟意味着什么?
  6. C++之父访谈录:我也没想到 C ++ 会这么成功!
  7. 怎样用 Python 控制图片人物动起来?一文就能 Get!
  8. 强烈推荐 16 款 IDEA 插件,让你的开发速度飞起来 | 原力计划
  9. 漫画:什么是 “模因” ?
  10. 手机很早就有飞行模式了,为什么最近几年坐飞机才不用关机?