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

Dumping elastic data into csv or into any NOSQL through python

据我们所知,由于连接错误问题,我们无法从弹性搜索中获取 python 中超过 10000 行。我想从我的弹性集群中获取两个小时的数据,并且每 5 分钟,我进行大约 10000 次观察。

1.) 如果我可以将弹性搜索中的数据直接转储到 csv 或一些计数超过 10000 的 Nosql 数据库中,有什么办法吗?

我在 python 中编写我的代码。

我使用的是 elasticsearch 版本 5

试试下面的滚动查询代码

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)