paweloque paweloque - 3 years ago 181
JSON Question

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
?

Answer Source

You can always do MyDoc(**my_dict)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download