2016-04-11 20 views
0

elasticsearch接続を確立してインデックスを作成しようとしています。しかし、私は次のエラーを取得する:次のように最大再試行超過 - Elasticsearch

elasticsearch.exceptions.ConnectionError: ConnectionError(HTTPConnectionPool(host='localhost', port=9200): Max retries exceeded with url: /test-index (Caused by <class 'socket.error'>: [Errno 111] Connection refused)) caused by: MaxRetryError(HTTPConnectionPool(host='localhost', port=9200): Max retries exceeded with url: /test-index (Caused by <class 'socket.error'>: [Errno 111] Connection refused)) 

私のコードは次のとおりです。

self.es = Elasticsearch(hosts=[{"host": "http://192.168.0.5:9200", "port": 9200}], timeout=10) 

self.es.indices.create(index='test-index', ignore=400)  

答えて

1

あなたは正しくクライアントを設定しないでください。それでもlocalhost:9200に接続しようとします。デフォルトのポートは9200なので、省略することができます。 代わりにこれを試してみてください:

self.es = Elasticsearch(hosts=[{"host": "192.168.0.5"}], timeout=10) 

をあなたはdocumentation

+0

でより多くの情報を見つけることができる非常に多くの@Yasin Bahtiyarありがとう –

関連する問題