Area: Product Issues
Sub-Area: Structured Properties / Elasticsearch Index Management
Applies to: OSS + Cloud
Issue
You hard delete a structured property. Then you try to create a structured property with the same qualified name, and DataHub rejects it with this error:
Structured property Elasticsearch field 'global_env' (from qualifiedName='global.env') already exists in the entity-index mapping. This is either a live collision with another property whose qualified name normalizes to the same field ('.' and '_' both normalize to '_'), or a residual mapping left by a hard-deleted property with this field name (Elasticsearch cannot drop a field from a mapping, so the field survives the delete). To resolve: choose a qualified name that stays distinct after '.'->'_', or, when recreating a deleted property, complete its assignment cleanup and reindex the entity indices (via the SystemUpdate job) before recreating it.
DataHub Cloud v2.2.0 and later and DataHub v1.8.0 and later print this message. DataHub v1.7.0 runs the same check with a shorter message:
Structured property Elasticsearch field 'global_env' collides with existing property mapping. Qualified names that differ only by '.' vs '_' normalize to the same field name (proposed qualifiedName='global.env').
You Might Be Asking
- Why can't I recreate a structured property after I deleted it?
- Why does DataHub block a new structured property when no other property has that name?
- How do I clear the leftover search field of a hard-deleted structured property?
- Can I fix this myself on DataHub Cloud?
- How do I delete a structured property so that I can bring it back later?
Cause
DataHub stores each structured property's values in a search index field. The field name is the qualified name with every . replaced by _. So global.env and global_env use the same field, global_env. DataHub adds this field to the index of every entity type listed in the property's definition.
Elasticsearch can add a field to an index mapping, but it cannot remove one. When you hard delete a structured property, DataHub removes the definition and then removes its values from your assets in the background. The field stays in the index mappings until the indices are rebuilt.
When you create a new structured property, DataHub checks whether its field name is already in the index mappings. If it is, DataHub rejects the create. The field is there for one of two reasons:
- A live collision. Another structured property, active or soft deleted, has a qualified name that gives the same field name.
- A residual mapping. A hard-deleted property left the field behind.
A deleted property is gone from DataHub, so a residual mapping blocks the name even when no current property uses it.
Solution
Step 1: Find out which case you have
Check whether another structured property, including a soft-deleted one, has a qualified name that becomes the same field name after . changes to _. If one does, this is a live collision. Rebuilding the indices does not fix a live collision. Choose a qualified name that stays different after the change.
If the property you want to recreate was soft deleted and not hard deleted, do not create it again. Restore it instead (see "Avoid this next time" below). DataHub rejects any write to the definition of a soft-deleted property with Cannot mutate a soft deleted Structured Property Definition.
If the property was hard deleted, continue with Step 2.
Step 2: Let the value cleanup finish
After a hard delete, DataHub removes the property's values from your assets in the background. If one asset still holds a value, the rebuild keeps the field in that entity type's index. Wait for this cleanup to finish before you rebuild.
Step 3: Rebuild the entity indices
The DataHub system-update job rebuilds the indices and removes fields of deleted structured properties. The steps are in Index Mappings Cleanup.
On DataHub Cloud, you cannot run this job yourself. Contact DataHub Support. Give them the qualified name of the deleted property and the full error message.
On a self-hosted deployment, run the system-update job with these environment variables set to true:
ELASTICSEARCH_INDEX_BUILDER_MAPPINGS_REINDEX=true
ENABLE_STRUCTURED_PROPERTIES_SYSTEM_UPDATE=true
With the DataHub Helm chart, these come from the following values. Both are true by default in the chart. A helm upgrade runs the system-update job.
datahubSystemUpdate:
enableStructuredProperties: true
global:
elasticsearch:
index:
enableMappingsReindex: true
The job recreates each affected index. On large indices this takes a long time.
Step 4: Confirm the field is gone (self-hosted only)
The field is in the index of every entity type listed in the deleted property's definition, not only the types that had values. Check each of those indices. Look at the index mapping with GET /<index name>/_mapping and confirm the field (for example global_env) is no longer under structuredProperties. Index names can carry a prefix in your deployment. On DataHub Cloud, DataHub Support does this check.
Step 5: Create the property again
When the field is gone from all affected indices, create the structured property again with the original qualified name, in the UI or through the API.
Avoid this next time
- If you might need a property again, soft delete it instead of hard deleting it. With the CLI,
datahub delete --urn "<property urn>"does a soft delete. A soft delete keeps the definition and the values, and you can undo it. Deleting a property in the DataHub UI is a hard delete. - To bring back a soft-deleted property, restore it with
datahub delete undo-by-filter --urn "<property urn>", or setremovedtofalsein itsstatusaspect as shown in Soft Delete. Do not create it again. - Do not build automation that hard deletes and recreates structured properties with the same qualified names. Each hard delete blocks the name again until the indices are rebuilt.
- Setting a
versionon a property is not a fix for this error. It is for breaking changes to a live property, such as changing cardinality. After a breaking change, existing values no longer show in search, filters or aggregations. See Update Structured Property With Breaking Schema Changes.
Related Documentation
- Delete Structured Properties
- Index Mappings Cleanup
- Soft Delete
- Update Structured Property With Breaking Schema Changes
- Environment Variables
Tags: structured-properties, elasticsearch, hard-delete, field-mapping, reindex, SystemUpdate, qualified-name, index-rebuild, soft-delete