-
Notifications
You must be signed in to change notification settings - Fork 802
Closed
Labels
Category: BugSomething isn't rightSomething isn't right
Description
Hi there!
Thanks for your work.
I have the following code
from elasticsearch_dsl import InnerDoc, DocType, Object, Nested
class DummyInnerDoc(InnerDoc): pass
class TestDocument(DocType):
spam = Object(DummyInnerDoc)
eggs = Nested(DummyInnerDoc)
TestDocument._doc_type.mapping.to_dict()
and got mapping with type nested for both fields:
{'properties': {'spam': {'type': 'nested'}, 'eggs': {'type': 'nested'}}}
but expected that mapping should be:
{'properties': {'spam': {'type': 'object'}, 'eggs': {'type': 'nested'}}}.
If I switch fields order to (nested first and object second):
class TestDocument(DocType):
eggs = Nested(DummyInnerDoc)
spam = Object(DummyInnerDoc)
I got type object for both fields.
Is it an expected behavior to keep same mapping for concrete InnerDoc? If so, what do you recommend to me when I need to have same InnerDoc for Object and Nested fields in document?
Of course, I can declare second class like class NestedDummyInnerDoc(DummyInnerDoc): pass and use it for nested fields, but is it right way to solve my problem?
Thanks for help.
Metadata
Metadata
Assignees
Labels
Category: BugSomething isn't rightSomething isn't right