Open dduong42 opened 9 years ago
Environment: Python 3
When fetching for a mapping I got this error:
In [1]: import pyes In [2]: es = pyes.es.ES() In [3]: data = es.indices.get_mapping(doc_type='category', indices='catalog') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-7fea737910c0> in <module>() ----> 1 data = es.indices.get_mapping(doc_type='category', indices='catalog') /home/daniel/.envs/oshop/lib/python3.4/site-packages/pyes/managers.py in get_mapping(self, doc_type, indices, raw) 453 mapper = Mapper(result, is_mapping=False, 454 connection=self.conn, --> 455 document_object_field=self.conn.document_object_field) 456 if doc_type: 457 return mapper.mappings[doc_type] /home/daniel/.envs/oshop/lib/python3.4/site-packages/pyes/mappings.py in __init__(self, data, connection, is_mapping, document_object_field) 825 self.full_mappings = False 826 self.document_object_field = document_object_field --> 827 self._process(data) 828 829 def _process(self, data): /home/daniel/.envs/oshop/lib/python3.4/site-packages/pyes/mappings.py in _process(self, data) 835 idata = [] 836 for docname, docdata in list(indexdata.get("mappings", {}).items()): --> 837 o = get_field(docname, docdata, document_object_field=self.document_object_field, is_document=True) 838 o.connection = self.connection 839 o.index_name = indexname /home/daniel/.envs/oshop/lib/python3.4/site-packages/pyes/mappings.py in get_field(name, data, default, document_object_field, is_document) 793 else: 794 data.pop("name",None) --> 795 return DocumentObjectField(name=name, **data) 796 797 elif _type == "object": TypeError: __init__() keywords must be strings
After some investigation, the problem comes from this line, converting the keys of the data dictionary into byte objects:
data = keys_to_string(data)
Environment: Python 3
When fetching for a mapping I got this error:
After some investigation, the problem comes from this line, converting the keys of the data dictionary into byte objects: