0

haystack v2.0.0-beta、pyelasticsearch 0.0.6。"python managy rebuid_index" を実行しようとすると、エラーが発生します:

File "/usr/lib/python2.6/site-packages/pyelasticsearch-0.0.6-py2.6.egg/pyelasticsearch.py", line 266, in bulk_index
response = self._send_request('POST', path, body, {'op_type':'create'}, prepare_body=False)

TypeError: _send_request() が予期しないキーワード引数 'prepare_body' を取得しました

pyelasticsearch.py​​ の詳細:

#+
    def bulk_index(self, index, doc_type, docs, id_field="id"):
        """
        Indexes a list of documents as efficiently as possible.
        """
        body_bits = []

        if not len(docs):
            raise ElasticSearchError("No documents provided for bulk indexing!")

        for doc in docs:
            action = {"index": {"_index": index, "_type": doc_type}}

            if doc.get(id_field):
                action['index']['_id'] = doc[id_field]

            body_bits.append(self._prep_request(action))
            body_bits.append(self._prep_request(doc))

        path = self._make_path(['_bulk'])
        # Need the trailing newline.
        body = '\n'.join(body_bits) + '\n'
        response = self._send_request('POST', path, body, {'op_type':'create'}, prepare_body=False)
        return response
#+

実際、エラー " " の後、自分で bulk_index を追加しましself.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID) AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'た。リンクhttps://github.com/toastdriven/pyelasticsearch/blob/master/pyelasticsearch.py ​​#L424-469 をたどってください 。アドバイスや参考文献をいただければ幸いです。

4

0 に答える 0