2013-04-20 16 views
6

elasticsearchでdjango-haystackを使用していますが、インデックス作成に問題があります。私のインデックスを再構築するときDjango haystack with elasticsearch、indexing issue

 python manage.py rebuild_index
次のエラーが発生します

 
Traceback (most recent call last): 
    File "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 210, in handle_label 
    self.update_backend(label, using) 
    File "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 256, in update_backend 
    do_update(backend, index, qs, start, end, total, self.verbosity) 
    File "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 78, in do_update 
    backend.update(index, current_qs) 
    File "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 177, in update 
    self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID) 
    File "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 95, in decorate 
    return func(*args, query_params=query_params, **kwargs) 
    File "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 366, in bulk_index 
    query_params=query_params) 
    File "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 221, in send_request 
    **({'data': request_body} if body else {})) 
    File "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 387, in post 
    return self.request('POST', url, data=data, **kwargs) 
    File "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 345, in request 
    resp = self.send(prep, **send_kwargs) 
    File "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 448, in send 
    r = adapter.send(request, **kwargs) 
    File "/home/palo/.virtualenvs/toro/src/requests/requests/adapters.py", line 324, in send 
    raise Timeout(e) 
Timeout: HTTPConnectionPool(host='127.0.0.1', port=9200): Request timed out. (timeout=10) 
Timeout: HTTPConnectionPool(host='127.0.0.1', port=9200): Request timed out. (timeout=10) 

私はジャンゴ・干し草を使用 - 2.0.0ベータ、pyelasticsearch - 0.5、elasticsearch 0.20.6、Javaのバージョン "1.6.0_24"


干し草設定

 

    HAYSTACK_CONNECTIONS = { 
     'default': { 
      'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', 
      'URL': 'http://127.0.0.1:9200/', 
      'INDEX_NAME': 'haystack', 
     }, 
    } 

とIM私のelasticsearchのserivceが実行されていることを確認。

+0

を働きました。 "curl -XGET 'localhost:9200'"の結果は何ですか? JSON出力にはサーバーのステータスとバージョンが表示されます。 – bennylope

+0

これは解決されるかどうか –

答えて

13

これは必ずしもあなたのサーバーがダウンしているとは限りません。特に、curl -I "127.0.0.1:9200"で返される妥当なものが得られた場合は、おそらく、接続の速度があれば、十分な時間が得られないという要求の問題です。

興味深いことに、pyelasticsearchで設定されるデフォルトのタイムアウトは、def __init__(self, urls, timeout=60, max_retries=0, revival_delay=300):https://github.com/rhec/pyelasticsearch/blob/master/pyelasticsearch/client.pyを参照してください。ただし、干し草はデフォルト設定であるself.timeout = connection_options.get('TIMEOUT', 10)https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/__init__.py)の10秒で上書きされます。

haystackでは、エンジン設定に'TIMEOUT': 60,を追加することで、簡単に設定を変更することができます。

そして

-2

:)を解決するには、私はあなたがサーチエンジンを実行していないと思います

bin/elasticsearch -f 

を実行しています。

1

私はあまりにも

を再起動elasticsearch同様の問題

sudoのサービスを持っていた、それはあなたのElasticSearchインスタンスが使用できないようですね

+0

これは、サーバーのディスク領域が不足した後、私の問題を解決しました。 – creimers