How to get a list of all indexes in python-elasticsearch

后端 未结 7 1880
北海茫月
北海茫月 2021-02-06 20:32

How would I get a list of the names of an index in Python? Here is what I have so far:

>>> es=e.es
>>> es


        
7条回答
  •  后悔当初
    2021-02-06 21:11

    I use curl to call the stats API and get information about the indices. Then I parse the JSON object that is returned to find the index names.

    curl localhost:9200/_stats
    

    In Python you can call curl using the requests library. I don't know of a way to do this using the Elasticsearch or Elasticsearch-DSL Python library.

提交回复
热议问题