Search code examples
pythonjsondjangoelasticsearch-dsl

Creating elasticsearch-dsl DocType objects from dict or json


I'm using the elasticsearch-dsl library to define mappings in elasticsearch and to index django model objects. For initial indexing I, however, want to use json data for all models. Is there a way to instantiate DocType subclass objects directly from json or from a python dict?


Solution

  • You can always do MyDoc(**my_dict)