elasticdump \
--input=http://production.es.com:9200/my_index \
--output=query.json \
--searchBody='{"query":{"term":{"username": "admin"}}}'
注释:searchBody 填写你的条件,其中 {“query”:{“term”:{}}} 是固定格式,“username” 是你的条件字段的名字,后面紧跟的 admin 是值。
例如:
//导出 "id" = 10的所有数据
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=query.json \
--searchBody='{"query":{"term":{"id": "10"}}}'
- ES数据导出时默认为100条,如果需要大批量的导出数据,这速度就可想而知了,那么为了方便起见,ES 提供了 limit 参数用于配置每次请求导出时的数量限制。
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=query.json \
--limit 10000