You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OSBulkHelper.getIndexName() always returns the hardcoded fallback \"dotcms_content\" instead of the actual active index, because it passes DEFAULT_INDEX_SUFFIX (e.g. \"content\") to ContentletIndexAPI.getActiveIndexName(type), which only resolves when type is \"working\" or \"live\".
// OSBulkHelper.java line 286privateStringgetIndexName() {
// DEFAULT_INDEX_SUFFIX = "content" — never matches IndexType.WORKING or IndexType.LIVEreturnTry.of(() -> APILocator.getContentletIndexAPI().getActiveIndexName(DEFAULT_INDEX_SUFFIX))
.getOrElse(() -> {
Logger.warn(this, "Could not resolve active index name, using default");
return"dotcms_" + DEFAULT_INDEX_SUFFIX; // ← always lands here
});
}
getActiveIndexName returns null for any type that is neither "working" nor "live", so Try never fails but resolves to null, causing the getOrElse fallback to fire every time.
Current blast radius:OSBulkHelper is not wired into any production code path yet (only referenced in a test comment), so this is not causing active data loss. However it must be fixed before the class is used.
Acceptance Criteria
getIndexName() resolves the correct active OS working index (or live, depending on caller intent) using versionedIndicesAPI directly or a dedicated OS-aware resolution method
The fallback path (Logger.warn + "dotcms_content") is only reached when no index exists, not on every call
A unit test covers both the happy path and the fallback
Additional Context
File: dotCMS/src/main/java/com/dotcms/content/index/opensearch/OSBulkHelper.java line 286
Description
OSBulkHelper.getIndexName()always returns the hardcoded fallback\"dotcms_content\"instead of the actual active index, because it passesDEFAULT_INDEX_SUFFIX(e.g.\"content\") toContentletIndexAPI.getActiveIndexName(type), which only resolves whentypeis\"working\"or\"live\".getActiveIndexNamereturnsnullfor any type that is neither"working"nor"live", soTrynever fails but resolves tonull, causing thegetOrElsefallback to fire every time.Current blast radius:
OSBulkHelperis not wired into any production code path yet (only referenced in a test comment), so this is not causing active data loss. However it must be fixed before the class is used.Acceptance Criteria
getIndexName()resolves the correct active OS working index (or live, depending on caller intent) usingversionedIndicesAPIdirectly or a dedicated OS-aware resolution methodLogger.warn + "dotcms_content") is only reached when no index exists, not on every callAdditional Context
dotCMS/src/main/java/com/dotcms/content/index/opensearch/OSBulkHelper.javaline 286ContentletIndexAPI.getActiveIndexNamesource:ContentletIndexAPIImpl.javaline 2568