代码之家  ›  专栏  ›  技术社区  ›  chowpay

将python elasticsearch响应转换为表或csv

  •  0
  • chowpay  · 技术社区  · 6 年前

    偷这个例子( Format the output of elasticsearch-py )

    import logging
    logging.basicConfig()
    
    from elasticsearch import Elasticsearch as ES
    
    print "Setup connection..."
    es=ES(['localhost:8080'])
    print "Done!"
    
    print "Count number of users..."
    print es.count(index='users')
    

    {u'count': 836780, u'_shards': {u'successful': 5, u'failed': 0, u'total': 5 ... ... }}
    

    我只想把^转换成csv

    我应该试着把它转换回json然后再转换成csv还是直接转换?

    0 回复  |  直到 6 年前