You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to define a field called "meta" on my Document. I read and understood the documentation that states:
Having all metadata accessible through meta means that this name is reserved and you shouldn’t have a field called meta on your document. If you, however, need it you can still access the data using the get item (as opposed to attribute) syntax: post['meta'].
Let's suppose I would like to define following Document:
I would like to define my mapping, including the field called "meta". How do I do that? I am ripping my hair out of this since I cannot find any way to do that, like meta_ = elastic.Keyword(actual_field_name='meta'), which would be comparable to other libraries' options (like Pydantic) in DocumentOptions or anything.
I would be also happy if someone could point out a way how I could add it to the mapping in some other way that does not blow elasticsearch-dsl's internals.
Changing the field name in my schema would be possible, but a hassle and from an ideal point of view, I do not want to.
However, I would also be curious about the decision making in this case. If I understood correctly, we are solely talking about providing an accessor for metadata for "ORM" model instances and what we are discussing here is not at all touching Elasticsearch's internals since it happily accepts a field called meta. Furthermore, "meta" does not sound like a terrible unlikely name for a document's field. So, if I understand correctly, no one who wants to use elasticsearch-dsl and its declarative persistence can ever declare this field.
Would it not make more sense to provide metadata in some way that has less likelihood of collisions? post.meta_ or post.elastic_meta or elasticsearch.meta(post)?
The text was updated successfully, but these errors were encountered:
However, I would also be curious about the decision making in this case.
Would it not make more sense to provide metadata in some way that has less likelihood of collisions?
Hard to say. I have not participated in these decisions, which were made many years ago and predate my involvement in this project. I can be wrong on this, but I do not recall this ever being raised before as a big issue, because it is assumed that some concessions have to be made to allow this package to do its work in the most idiomatic way. You always have the option to send raw requests using the regular Python client if the DSL package does not work for you.
I would like to define a field called "meta" on my Document. I read and understood the documentation that states:
Let's suppose I would like to define following Document:
I would like to define my mapping, including the field called "meta". How do I do that? I am ripping my hair out of this since I cannot find any way to do that, like
meta_ = elastic.Keyword(actual_field_name='meta')
, which would be comparable to other libraries' options (like Pydantic) inDocumentOptions
or anything.I would be also happy if someone could point out a way how I could add it to the mapping in some other way that does not blow elasticsearch-dsl's internals.
Changing the field name in my schema would be possible, but a hassle and from an ideal point of view, I do not want to.
However, I would also be curious about the decision making in this case. If I understood correctly, we are solely talking about providing an accessor for metadata for "ORM" model instances and what we are discussing here is not at all touching Elasticsearch's internals since it happily accepts a field called
meta
. Furthermore, "meta" does not sound like a terrible unlikely name for a document's field. So, if I understand correctly, no one who wants to use elasticsearch-dsl and its declarative persistence can ever declare this field.Would it not make more sense to provide metadata in some way that has less likelihood of collisions?
post.meta_
orpost.elastic_meta
orelasticsearch.meta(post)
?The text was updated successfully, but these errors were encountered: