Inconsistent re-index behavior when toggling 'User Searchable' attribute on content type fields
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Problem Statement
Toggling the "User Searchable" attribute on a content type field produces asymmetric re-indexing behavior:
- Enabling "User Searchable": The field does not become immediately searchable in the Elasticsearch/Lucene index. A manual re-publish of existing contentlets is required before the field value appears in search results.
- Disabling "User Searchable": The change takes effect immediately — an automatic re-index occurs, making the field non-searchable without any re-publish.
This inconsistency is confusing and error-prone: content editors who enable the attribute may not realize they need to manually re-publish all contentlets for the change to take effect, while disabling it requires no such action.
Observed with: All field types that support the "User Searchable" attribute.
Steps to Reproduce
Setup:
- Create a content type with two fields of any type that supports "User Searchable":
- Field A: "User Searchable" = enabled
- Field B: "User Searchable" = disabled
- Create and publish a contentlet with values in both fields.
Use Case 1 — Enabling "User Searchable" (requires manual re-publish):
- Edit Field B's definition and enable "User Searchable". Save the content type.
- Immediately query Kibana / Elasticsearch using a Lucene query targeting Field B's value.
- Result: Field B's value is not returned — the field is not yet indexed as searchable.
- Re-publish the contentlet.
- Re-run the same Lucene query.
- Result: Field B's value now appears in the index and is searchable.
Use Case 2 — Disabling "User Searchable" (automatic re-index, no re-publish needed):
- Edit Field B's definition and disable "User Searchable". Save the content type.
- Immediately query Kibana / Elasticsearch using a Lucene query targeting Field B's value.
- Result: Field B's value is no longer returned — the field was automatically removed from the index without any re-publish.
Inconsistency: Enabling requires a manual re-publish; disabling does not.
Acceptance Criteria
- When "User Searchable" is enabled on any field type that supports the attribute, existing published contentlets of that content type become immediately searchable via Lucene query without requiring a manual re-publish.
- When "User Searchable" is disabled on any field type that supports the attribute, existing published contentlets are immediately no longer searchable via Lucene query (current behavior preserved, no regression).
- Both enable and disable operations produce consistent, symmetric re-indexing behavior — no asymmetry between the two.
- Original bug no longer reproduces: enabling "User Searchable" on a field and immediately querying via Lucene returns the field value without needing to re-publish the contentlet.
- Enabling or disabling "User Searchable" on a field does not affect the indexing behavior of other fields or contentlets belonging to other content types.
dotCMS Version
Latest from main branch
Severity
Medium - Some functionality impacted
Links
NA
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the content type field save flow and the Elasticsearch indexing path for changes to the "User Searchable" attribute. Reproduce both enabling and disabling with the supplied steps, then verify that existing published contentlets become searchable or non-searchable immediately while other fields and content types remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, java
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100