Elastic Search No server available, list index out of range

浪尽此生 提交于 2019-12-13 19:07:45

问题


I'm trying to get a simple example working with elastic search using pyes, but I'm having trouble getting the starting examples working. I'm following the documentation found here: http://pyes.readthedocs.org/en/latest/manual/usage.html

and just trying to run the following function, but It's not quite working.

def index_transcripts():
    conn = ES('127.0.0.1:9200')
    conn.indices.create_index("test-index")

index_transcripts()

Which in my mind should be very straightforward, but instead I get the following error:

pyes.exceptions.NoServerAvailable: list index out of range

I'm just starting out with Elastic Search and pyes seems like a wonderful library, but I'm clearly uncertain on how exactly I should use it. Any help would be greatly appreciated.


回答1:


This will work:

ES(server=[('http', 'localhost', 9200)])

Server is a list of tuples.

Documentation to this is here: http://pyes.readthedocs.org/en/latest/references/pyes.connection.html



来源:https://stackoverflow.com/questions/16905295/elastic-search-no-server-available-list-index-out-of-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!