I was wandering what is the best way to add custom metadata for documents in elasticsearch.
Lets say I have a document of type Test
"Test": {
"properties": {
"TestName": {
"type": "string"
},
"LastRunTime": {
"type": "string"
},
"id": {
"type": "string"
},
"lastUpdate": {
"type": "string"
}
....
}
And I would like to add for each field name - a display name. e.g.
"TestName": {
"type": "string"
"display_name": "Test Name"
},
"LastRunTime": {
"type": "string"
"display_name": "Last Run Time"
}
What is the best way to do it?
I know there's a field called _meta
in an index mapping, is this the way to go?
I would also love if this metadata could be returned in each search query I perform on that index.
My suggestion would be to just use another field. It doesn't have to be indexed. It's simpler and you can use _source
filtering to retrieve or ignore it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With