BlueXIII's Blog

热爱技术,持续学习

0%

ES导出CSV

参考文档

Github

参数

  • -i 索引名
  • -q query dsl
  • -a 认证信息 格式:user: password
  • -u esurl 格式: http://ip:9200
  • -o 命名
  • -r qurey formated

示例

1
2
3
4
5
6
7
8
9
# 需要python2.7环境
conda create --name py27 python=2.7
conda activate py27

# 安装es2csv
pip install es2csv

# 导出
es2csv -i policies_hydrabot -u 10.20.41.30:9200 -o dump.csv -r -q '{"_source":["title","url","collectTime","createTime"],"query": {"range": {"collectTime": {"gt": "2021-10-01 00:00:00"}}}}'