django-elasticsearch-dsl
django-elasticsearch-dsl copied to clipboard
Auto-generate Nested and Object fields from DocType
Currently, a lot of extra code is required in defining the mapping of the nested fields for more complicated mapping. This can be a real pain when working with a larger database schema. So now, when the DocTypeMeta class is being instantiated, the __new__
method reads the related_model_settings
attribute which just contains parts of schema that requires manual overriding (Please refer to updated readme for an example).
The method then simply parses the attribute and generates Object / Nested fields respectively and adds to attrs
.
Currently, sub-nested methods are ignored to prevent excessively huge entries in the index. This can be easily extended in the future.