However, it cannot be deleted with the following command:
PUT iislog/_mapping { “derived”: { “file”: null } }
{ “error”: { “root_cause”: [ { “type”: “mapper_parsing_exception”, “reason”: “Expected map for property [derived_fields] on field [file] but got a class java.lang.String” } ], “type”: “mapper_parsing_exception”, “reason”: “Expected map for property [derived_fields] on field [file] but got a class java.lang.String” }, “status”: 400 }
@mhkang589 I think the derived fields cannot be deleted, this follows the general rule of updating mappings in OpenSearch, You can add a field to mappings, but not delete it.
There are a number of workaround however:
If this is the only derived field, you can disabled the derived fields on that index, using the following:
PUT iislog/_settings
{
"index.query.derived_field.enabled": false
}
You can skip the emit stage by updating the derived field as follows:
"source": """
// Intentionally emit nothing: derived field will always be empty
if (false) {
emit("");
}
"""
If you absolutely need to remove this field reindexing is the last option.