Unable to serialize type: <class 'elasticsearch_dsl.document.InnerDoc'

I am just in the process of moving from an old version of Elasticsearch to 6.8. All is going well except that I am getting the above error when attempting to update\add a record.

This is my code

if not isinstance(existing_es_doc, dict):
    esdoc_clean = existing_es_doc.to_dict()
else:
    esdoc_clean = existing_es_doc

r = es.update(index=index,  doc_type='product_set_change_log', id=self.isbn_id + '-%s' % self.api_id,
                          body={'doc': esdoc_clean, 'doc_as_upsert': True})

The full error is

TypeError("Unable to serialize {'territories': [], 'salesRightsType': u'01'} (type: <class 'elasticsearch_dsl.document.InnerDoc'>)",))

The type that it is referring too is InnerDoc, I can see that in the esdoc_clean dict.

As part of the migration this import was no longer valid

from elasticsearch_dsl import InnerObjectWrapper

I get my body from another service, so I can't modify that

This worked on the older Elasticsearch version

Has anyone seen this before?

Thanks

Grant

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.