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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过python将弹性数据转储到csv或任何NOSQL中相关的知识,希望对你有一定的参考价值。

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

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

我在python中编写代码。

我有弹性搜索版本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)

以上是关于通过python将弹性数据转储到csv或任何NOSQL中的主要内容,如果未能解决你的问题,请参考以下文章