The _meta field makes it possible to attach custom metadata at the mapping type level. I've come through a few use cases recently (see genesis here) where it'd be handy to have a _meta field at the document level, too, in order to attach technical-/business-specific metadata that doesn't necessarily belong to the core of the document itself.
When indexing a new document, we'd be able to specify the _meta hash inside the document and ES would extract it (as it used to do with other meta fields back in the days)
I could neither find any existing or past issues nor discussion threads on this subject. I'm curious to know what would be the cons and pros of adding such a feature?
Hey there. I am curious to understand why does it matters if the _meta field comes nested or not in _source field. If the field is already named _meta, wouldn't this be enough so the application handles it differently?
Hey Thiago, thanks for dropping by. If you look at the second link I provided, you'll understand how it could be useful in some cases.
Long story short, since the Update API doesn't support ingestion pipelines (yet?), one alternative would be to have such a meta field where document-level metadata could be added without the risk of being overwritten when reindexing the document as a whole.
You could, though, implement a plugin that does what you want. The only caveat is that I don't think a plugin can add custom metadata to a document but this can be easily solved by handling the _meta field differently (maybe it's possible to add custom metadata, but needs investigation)
Yes indeed, the best way to handle this would be via the ingestion pipelines being supported by the Update API. I've been following that issue for a while now and it seems to drive substantial interest, indeed. Let's see what happens.
Having a document-level _meta field could be nice, even though if it's not the primary focus here, merely a way to circumvent the lack of support for ingestion pipelines in the Update API.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.