Version 0.0.4 of elasticsearch-dsl-py fails. It seems like the Result object has changed and no longer contains the _meta attribute.
Temporary solution: use elasticsearch-dsl-py version 0.0.3dev.
======================================================================
ERROR: test_concat_queries (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 234, in test_concat_queries
items = Article.objects.bsearch_title_search('title')[::False] + NoUpdatedField.objects.search.query('match', title='My title')[::False]
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 341, in __getitem__
results = super(Bungiesearch, self).__getitem__(key).execute()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 286, in execute
self.map_results()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 295, in map_results
self.results = Bungiesearch.map_raw_results(self.raw_results, self)
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 171, in map_raw_results
model_name = result._meta.doc_type
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
ERROR: test_fetch_item (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 76, in test_fetch_item
self.assertEqual(Article.objects.search.query('match', _all='Description')[0], Article.objects.get(title='Title one'), 'Searching for "Description" did not return just the first Article.')
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 341, in __getitem__
results = super(Bungiesearch, self).__getitem__(key).execute()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 286, in execute
self.map_results()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 295, in map_results
self.results = Bungiesearch.map_raw_results(self.raw_results, self)
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 171, in map_raw_results
model_name = result._meta.doc_type
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
ERROR: test_iteration (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 92, in test_iteration
self.assertTrue(all([result in db_items for result in lazy_search]), 'Searching for title "title" did not return all articles.')
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 312, in __iter__
self.execute()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 286, in execute
self.map_results()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 295, in map_results
self.results = Bungiesearch.map_raw_results(self.raw_results, self)
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 171, in map_raw_results
model_name = result._meta.doc_type
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
ERROR: test_optimal_queries (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 228, in test_optimal_queries
src_item = NoUpdatedField.objects.search.query('match', title='My title')[0]
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 341, in __getitem__
results = super(Bungiesearch, self).__getitem__(key).execute()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 286, in execute
self.map_results()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 295, in map_results
self.results = Bungiesearch.map_raw_results(self.raw_results, self)
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 171, in map_raw_results
model_name = result._meta.doc_type
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
ERROR: test_post_save (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 178, in test_post_save
self.assertNotEqual(find_three[0:1:True]._meta.index, find_three[1:2:True]._meta.index, 'Searching for "three" did not return items from different indices.')
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
ERROR: test_search_aliases (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 144, in test_search_aliases
self.assertTrue(all([result in db_items for result in title_alias]), 'Alias searching for title "title" did not return all articles.')
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 312, in __iter__
self.execute()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 286, in execute
self.map_results()
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 295, in map_results
self.results = Bungiesearch.map_raw_results(self.raw_results, self)
File "/[redacted]/bungiesearch/bungiesearch/__init__.py", line 171, in map_raw_results
model_name = result._meta.doc_type
File "/home/chris/.virtualenvs/bungiesearch/src/elasticsearch-dsl-master/elasticsearch_dsl/utils.py", line 109, in __getattr__
'%r object has no attribute %r' % (self.__class__.__name__, attr_name))
AttributeError: 'Result' object has no attribute '_meta'
======================================================================
FAIL: test_raw_fetch (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 84, in test_raw_fetch
self.assertTrue(hasattr(item, '_meta'), 'Fetching first raw results did not return an object with a _meta attribute.')
AssertionError: Fetching first raw results did not return an object with a _meta attribute.
======================================================================
FAIL: test_specify_index (tests.core.test_bungiesearch.ModelIndexTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/[redacted]/bungiesearch/tests/core/test_bungiesearch.py", line 266, in test_specify_index
self.assertEqual(Article.objects.count(), Article.objects.search_index('bungiesearch_demo').count(), 'Indexed items on bungiesearch_demo for Article does not match number in database.')
AssertionError: Indexed items on bungiesearch_demo for Article does not match number in database.
----------------------------------------------------------------------
Ran 22 tests in 10.372s
FAILED (failures=2, errors=6)
Version 0.0.4 of elasticsearch-dsl-py fails. It seems like the Result object has changed and no longer contains the
_meta
attribute.Temporary solution: use elasticsearch-dsl-py version 0.0.3dev.