通过python将弹性数据转储到csv或任何NOSQL中

问题描述 投票:0回答:1

我们知道,由于连接错误问题,我们无法从弹性搜索中获取超过10000行的python。我想要每隔5分钟从我的弹性丛集中获得两小时的数据,我有大约10000次观察。

1.)如果我可以将弹性搜索中的数据直接转储到csv或者超过10000计数的某个Nosql数据库中,是否有任何方法。

我在python中编写代码。

我有弹性搜索版本5

python python-3.x csv elasticsearch elastic-stack
1个回答
0
投票

尝试以下代码进行滚动查询

from elasticsearch import Elasticsearch, helpers

    es = Elasticsearch()
    es_index = "your_index_name"
    documento = "your_doc_type"


    body = {
            "query": {
            "term" : { "user" : user } 
                 }
            }

    res = helpers.scan(
                    client = es,
                    scroll = '2m',
                    query = body, 
                    index = es_index)
© www.soinside.com 2019 - 2024. All rights reserved.