django-elasticsearch-dsl icon indicating copy to clipboard operation
django-elasticsearch-dsl copied to clipboard

Auto-generate Nested and Object fields from DocType

Open akspi opened this issue 6 years ago • 0 comments

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.

akspi avatar Dec 15 '18 22:12 akspi