Hello.
Is there the way to exclude meta-fields (for example _id) from _all field?
The _all field is deprecated, and will be removed in 7.0. You can build your own custom _all equivalent with copy_to. See the _all docs.
Ryan thank you for your answer. We know about copy_to but copy_to doesn't support nested document.
we have json documents like this
{
"name": "Jeck",
"dynamic_fields": [ {"f1":"v1"}, {"f2":"v2"}]}
}
where structure of dynamic_fields is not known for us befor we recive this document.
We tried to set index mapping like this
{
"mappings": {
"doc": {
"properties": {
"dynamic_fields": {
"type": "nested",
"copy_to": "full_txt"
},
"full_txt": {
"type": "text"
}
}
}
}
}
But it doesn't work. We get "Mapping definition for [dynamic_fields] has unsupported parameters: [copy_to : full_txt]". This case is so important for us.
Is there way how we can solve this issue?
copy_to needs to be on a concrete field (ie not nested or object fields). If you don't know all the sub fields within your nested field, you could add the copy_to automatically using dynamic templates.
Ryan, If I understood correct, you suggested to use config like this
"dynamic_templates": [{
"full_txt_t": {
"path_match": "dynamic_fields.*",
"mapping": {
"copy_to": "full_txt"
}
}
}
]
Does it impact performance when we insert documents? Will ES check matching all field names with path_match in template? How much impact can It make on performance?
Dynamic templates only affect when a field does not yet exist, so it should not have a meaningful impact on performance. Whether a dynamic template exists, a field mapping must exist and will be created automatically when a field name is not found in the existing mappings.
Thank you very much. It is helpful for us