aparo / pyes

Python connector for ElasticSearch - the pythonic way to use ElasticSearch
BSD 3-Clause "New" or "Revised" License
607 stars 270 forks source link

Failing tests #276

Open tonyxiao opened 11 years ago

tonyxiao commented 11 years ago

I'm trying to contribute a ODM (Object Document Mapper) patch, however I noticed that as it stands, the current master fails nosetests with 5 errors and 1 failure. Is this expected / should I be concerned about them? I want to be sure that the all the tests pass before making major additions / potential refactoring. Test results are attached below

..EE....F..................E....................................E.E..................................

======================================================================
ERROR: test_TermQuery (tests.test_attachments.QueryAttachmentTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_attachments.py", line 71, in setUp
    self.conn.put_mapping(self.document_type, {self.document_type: {'properties': mapping}}, self.index_name)
  File "/Users/Tony/Code/pyes/pyes/decorators.py", line 46, in __inner
    return fun(*args, **kwargs)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 811, in put_mapping
    return self.indices.put_mapping(doc_type=doc_type, mapping=mapping, indices=indices)
  File "/Users/Tony/Code/pyes/pyes/managers.py", line 397, in put_mapping
    return self.conn._send_request('PUT', path, mapping)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 402, in _send_request
    raise_if_error(response.status, decoded)
  File "/Users/Tony/Code/pyes/pyes/convert_errors.py", line 83, in raise_if_error
    raise excClass(msg, status, result, request)
MapperParsingException: No handler for type [attachment] declared on field [attachment]
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 200 0
pyes: DEBUG: curl -XDELETE 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "DELETE /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"attachment": {"fields": {"date": {"store": "yes"}, "title": {"store": "yes", "term_vector": "with_positions_offsets"}, "attachment": {"store": "yes"}, "file": {"store": "yes"}, "author": {"store": "yes"}}, "type": "attachment"}, "uuid": {"index": "not_analyzed", "boost": 1.0, "store": "yes", "type": "string"}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/_mapping HTTP/1.1" 400 112
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_filesave (tests.test_attachments.TestFileSaveTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_attachments.py", line 19, in test_filesave
    self.conn.put_mapping(self.document_type, {self.document_type: {'properties': mapping}}, self.index_name)
  File "/Users/Tony/Code/pyes/pyes/decorators.py", line 46, in __inner
    return fun(*args, **kwargs)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 811, in put_mapping
    return self.indices.put_mapping(doc_type=doc_type, mapping=mapping, indices=indices)
  File "/Users/Tony/Code/pyes/pyes/managers.py", line 397, in put_mapping
    return self.conn._send_request('PUT', path, mapping)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 402, in _send_request
    raise_if_error(response.status, decoded)
  File "/Users/Tony/Code/pyes/pyes/convert_errors.py", line 83, in raise_if_error
    raise excClass(msg, status, result, request)
MapperParsingException: No handler for type [attachment] declared on field [my_attachment]
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 200 0
pyes: DEBUG: curl -XDELETE 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "DELETE /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"my_attachment": {"fields": {"date": {"store": "yes"}, "title": {"store": "yes"}, "file": {"store": "yes"}, "author": {"store": "yes"}}, "type": "attachment"}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/_mapping HTTP/1.1" 400 115
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_GeoDistanceFilter (tests.test_geoloc.GeoQuerySearchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_geoloc.py", line 51, in test_GeoDistanceFilter
    self.assertEquals(resultset.total, 1)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1494, in __getattr__
    self._do_search()
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1393, in _do_search
    self._results = self._search_raw(self.start, self.chuck_size)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1592, in _search_raw
    doc_types=self.doc_types, **query_params)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1166, in search_raw
    query = query.serialize()
  File "/Users/Tony/Code/pyes/pyes/query.py", line 109, in serialize
    res["query"] = self.query.serialize()
  File "/Users/Tony/Code/pyes/pyes/query.py", line 207, in serialize
    return {self._internal_name: self._serialize()}
  File "/Users/Tony/Code/pyes/pyes/query.py", line 582, in _serialize
    'filter': self.filter.serialize(),
  File "/Users/Tony/Code/pyes/pyes/filters.py", line 18, in serialize
    data = self._serialize()
  File "/Users/Tony/Code/pyes/pyes/filters.py", line 385, in _serialize
    if self.optimize_bbox:
AttributeError: 'GeoDistanceFilter' object has no attribute 'optimize_bbox'
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 404 0
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-mindex?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-mindex HTTP/1.1" 404 0
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-mindex?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-mindex HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-mindex/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"pin": {"properties": {"location": {"type": "geo_point"}}}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-mindex/test-type/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-mindex/test-type/1?pretty=true' -d '{"pin": {"location": {"lat": 40.12, "lon": -71.34}}}'
urllib3.connectionpool: DEBUG: "PUT /test-mindex/test-type/1 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-mindex/test-type/2?pretty=true' -d '{"pin": {"location": {"lat": 40.12, "lon": 71.34}}}'
urllib3.connectionpool: DEBUG: "PUT /test-mindex/test-type/2 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPOST 'http://127.0.0.1:9200/test-mindex/_refresh?pretty=true'
urllib3.connectionpool: DEBUG: "POST /test-mindex/_refresh HTTP/1.1" 200 60
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/_cluster/health?wait_for_status=green&timeout=0s&pretty=true'
urllib3.connectionpool: DEBUG: "GET /_cluster/health?wait_for_status=green&timeout=0s HTTP/1.1" 200 229
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_CustomScoreQueryJS (tests.test_queries.QuerySearchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_queries.py", line 240, in test_CustomScoreQueryJS
    self.assertEquals(resultset.total, 3)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1432, in total
    self._do_search()
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1393, in _do_search
    self._results = self._search_raw(self.start, self.chuck_size)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1592, in _search_raw
    doc_types=self.doc_types, **query_params)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1169, in search_raw
    return self._send_request('GET', path, body, params=query_params)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 402, in _send_request
    raise_if_error(response.status, decoded)
  File "/Users/Tony/Code/pyes/pyes/convert_errors.py", line 83, in raise_if_error
    raise excClass(msg, status, result, request)
ElasticSearchIllegalArgumentException: script_lang not supported [js]]; }
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 404 0
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"pos": {"type": "integer", "store": "yes"}, "uuid": {"index": "not_analyzed", "boost": 1.0, "store": "yes", "type": "string"}, "parsedtext": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "name": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "title": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/_mapping?pretty=true' -d '{"test-type2": {"_parent": {"type": "test-type"}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/1?pretty=true' -d '{"position": 1, "parsedtext": "Joe Testere nice guy", "name": "Joe Tester", "uuid": "11111"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/1 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/1?parent=1&pretty=true' -d '{"name": "data1", "value": "value1"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/1?parent=1 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/2?pretty=true' -d '{"position": 2, "parsedtext": "Bill Testere nice guy", "name": "Bill Baloney", "uuid": "22222"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/2 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/2?parent=2&pretty=true' -d '{"name": "data2", "value": "value2"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/2?parent=2 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/3?pretty=true' -d '{"position": 3, "parsedtext": "Bill is not\n                nice guy", "name": "Bill Clinton", "uuid": "33333"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/3 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPOST 'http://127.0.0.1:9200/test-index/_refresh?pretty=true'
urllib3.connectionpool: DEBUG: "POST /test-index/_refresh HTTP/1.1" 200 60
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/_cluster/health?wait_for_status=green&timeout=0s&pretty=true'
urllib3.connectionpool: DEBUG: "GET /_cluster/health?wait_for_status=green&timeout=0s HTTP/1.1" 200 229
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/test-index/test-type/_search?from=0&pretty=true&size=10' -d '{"query": {"custom_score": {"lang": "js", "query": {"match_all": {}}, "script": "parseFloat(_score*(5+doc.position.value))"}}}'
urllib3.connectionpool: DEBUG: "GET /test-index/test-type/_search?from=0&size=10 HTTP/1.1" 500 1030
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_CustomScoreQueryPython (tests.test_queries.QuerySearchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_queries.py", line 251, in test_CustomScoreQueryPython
    self.assertEquals(resultset.total, 3)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1432, in total
    self._do_search()
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1393, in _do_search
    self._results = self._search_raw(self.start, self.chuck_size)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1592, in _search_raw
    doc_types=self.doc_types, **query_params)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 1169, in search_raw
    return self._send_request('GET', path, body, params=query_params)
  File "/Users/Tony/Code/pyes/pyes/es.py", line 402, in _send_request
    raise_if_error(response.status, decoded)
  File "/Users/Tony/Code/pyes/pyes/convert_errors.py", line 83, in raise_if_error
    raise excClass(msg, status, result, request)
ElasticSearchIllegalArgumentException: script_lang not supported [python]]; }
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 404 0
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"pos": {"type": "integer", "store": "yes"}, "uuid": {"index": "not_analyzed", "boost": 1.0, "store": "yes", "type": "string"}, "parsedtext": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "name": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "title": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/_mapping?pretty=true' -d '{"test-type2": {"_parent": {"type": "test-type"}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/1?pretty=true' -d '{"position": 1, "parsedtext": "Joe Testere nice guy", "name": "Joe Tester", "uuid": "11111"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/1 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/1?parent=1&pretty=true' -d '{"name": "data1", "value": "value1"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/1?parent=1 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/2?pretty=true' -d '{"position": 2, "parsedtext": "Bill Testere nice guy", "name": "Bill Baloney", "uuid": "22222"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/2 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type2/2?parent=2&pretty=true' -d '{"name": "data2", "value": "value2"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type2/2?parent=2 HTTP/1.1" 201 77
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/3?pretty=true' -d '{"position": 3, "parsedtext": "Bill is not\n                nice guy", "name": "Bill Clinton", "uuid": "33333"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/3 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPOST 'http://127.0.0.1:9200/test-index/_refresh?pretty=true'
urllib3.connectionpool: DEBUG: "POST /test-index/_refresh HTTP/1.1" 200 60
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/_cluster/health?wait_for_status=green&timeout=0s&pretty=true'
urllib3.connectionpool: DEBUG: "GET /_cluster/health?wait_for_status=green&timeout=0s HTTP/1.1" 200 229
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/test-index/test-type/_search?from=0&pretty=true&size=10' -d '{"query": {"custom_score": {"lang": "python", "query": {"match_all": {}}, "script": "_score*(5+doc['position'].value)"}}}'
urllib3.connectionpool: DEBUG: "GET /test-index/test-type/_search?from=0&size=10 HTTP/1.1" 500 1483
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_ClusterHealth (tests.test_cluster.ClusterTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Tony/Code/pyes/tests/test_cluster.py", line 60, in test_ClusterHealth
    self.assertEqual(result['cluster_name'], 'elasticsearch')
AssertionError: u'elasticsearch_Tony' != 'elasticsearch'
-------------------- >> begin captured logging << --------------------
pyes: DEBUG: curl -XHEAD 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "HEAD /test-index HTTP/1.1" 404 0
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index?pretty=true'
urllib3.connectionpool: DEBUG: "PUT /test-index HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/_mapping?pretty=true' -d '{"test-type": {"properties": {"pos": {"type": "integer", "store": "yes"}, "uuid": {"index": "not_analyzed", "boost": 1.0, "store": "yes", "type": "string"}, "parsedtext": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "name": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}, "title": {"index": "analyzed", "term_vector": "with_positions_offsets", "boost": 1.0, "store": "yes", "type": "string"}}}}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/_mapping HTTP/1.1" 200 31
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/1?pretty=true' -d '{"position": 1, "parsedtext": "Joe Testere nice guy", "name": "Joe Tester", "uuid": "11111"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/1 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/2?pretty=true' -d '{"position": 2, "parsedtext": "Bill Testere nice guy", "name": "Bill Baloney", "uuid": "22222"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/2 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPUT 'http://127.0.0.1:9200/test-index/test-type/3?pretty=true' -d '{"position": 3, "parsedtext": "Bill is not\n                nice guy", "name": "Bill Clinton", "uuid": "33333"}'
urllib3.connectionpool: DEBUG: "PUT /test-index/test-type/3 HTTP/1.1" 201 76
pyes: DEBUG: curl -XPOST 'http://127.0.0.1:9200/test-index/_refresh?pretty=true'
urllib3.connectionpool: DEBUG: "POST /test-index/_refresh HTTP/1.1" 200 60
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/_cluster/health?wait_for_status=green&timeout=0s&pretty=true'
urllib3.connectionpool: DEBUG: "GET /_cluster/health?wait_for_status=green&timeout=0s HTTP/1.1" 200 229
pyes: DEBUG: curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
urllib3.connectionpool: DEBUG: "GET /_cluster/health HTTP/1.1" 200 230
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 101 tests in 19.081s

FAILED (errors=5, failures=1)
tonyxiao commented 11 years ago

Figured out. 3 of which are due to me not having correct plugins installed (namely mapper, lang-js, lang-python), a few others are due to genuine bugs. Have fixed them in my branch and all tests now pass. Will submit patch soon. Also added documentation to help people run tests See https://github.com/collections/pyes/commit/90b3a444230b5bd3260ea6029b9410816bdff52b#README.rst Will submit pull request when whole thing is ready.