# 分批循环查询 可以有效解决大批量一次查询问题
# ip
ip='172.17.xx.xx'
# es索引名
es_name='hbase_f_ent_patent_info_index_tbs_v20210707'
# 下载文件名
file_row_key='es_zl.json'
# 下载文件路径
file_dir='/home/dc_pd/xxx'
cd ${file_dir}
# 获取es索引数据量
es_cnt=`curl -XGET "http://${ip}:9201/${es_name}/_count" -d '{}'`
es_cnt=`echo ${es_cnt} | cut -d ':' -f2`
es_cnt=`echo ${es_cnt} | cut -d ',' -f1`
# 计算需要执行次数
cnt_n=$[es_cnt/1000]
# es索引_id下载 每次下载1000条 5分钟内可连续下载
curl -XGET "http://${ip}:9201/${es_name}/_search?pretty&filter_path=_scroll_id,hits.hits_id&scroll=5m" -d '{"from":0,"size":1000}' > ${file_row_key}
# 获取连续下载标识id
a=`cat ${file_row_key} | grep scroll_id`
b=`echo ${a} | cut -d '"' -f4`
echo ${b}
i=0
while (( ${i} <= ${cnt_n} ))
do
sleep 0.5s
echo '' > ${file_row_key}
curl -XGET "
批量下载es主键用于对比
最新推荐文章于 2023-11-27 15:28:38 发布