Description
Detail Bug Report
Introduced in #33479 by @anuj-kumary on Sep 18, 2026
Summary
- Context: The Data Insights app keeps a per-entity-type Elasticsearch/OpenSearch data stream in sync with the latest index template on every run;
updateDataAssetsDataStreaminDataInsightsSearchInterfaceimplements a documented recovery path that rolls the stream over when the engine rejects an in-place mapping change with HTTP 400. - Bug:
ElasticSearchDataInsightsClient.putWriteIndexMappingignores the HTTP status of thePUT /<stream>/_mapping?write_index_only=truerequest, and the pinnedRest5Client9.2.9 only throws on status ≥ 500 — so the 400 mapping-conflict never surfaces as anIOExceptionand the rollover recovery is dead code on Elasticsearch. - Actual vs. expected: Expected (per the Javadoc and the working OpenSearch implementation): a 400 is caught via
isMappingConflict,rolloverDataStreamis called, and the mapping is re-applied to a fresh write index. Actual on ES: the 400 is silently swallowed as a normalResponse, the stale write-index mapping persists, and recovery never runs. - Impact: On Elasticsearch deployments upgrading from pre-1.13, the documented compatibility fix never executes — incompatible/obsolete field types (e.g. fields that changed from simple to
nested/object) persist in the write index, new sub-fields (e.g. completeness facts) are silently not applied, and the DI app proceeds to run against a stream whose mapping was never updated; ES and OpenSearch deployments diverge.
Code with Bug
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/search/elasticsearch/ElasticSearchDataInsightsClient.java:
@Override
public void putWriteIndexMapping(String name, String mappings) throws IOException {
Request request = new Request("PUT", "/" + name + "/_mapping");
request.addParameter("write_index_only", "true");
request.setEntity(new StringEntity(mappings, ContentType.APPLICATION_JSON));
client.performRequest(request); // <-- BUG 🔴 returned Response's status is never checked; on 400 this silently succeeds
}openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/search/DataInsightsSearchInterface.java:
try {
putWriteIndexMapping(name, mappings);
} catch (IOException e) {
if (!isMappingConflict(e)) {
throw e;
}
rolloverDataStream(name);
putWriteIndexMapping(name, mappings); // <-- BUG 🔴 relies on IOException from 400, but ES client doesn't throw on 4xx
}Explanation
- The Elasticsearch DI client uses
Rest5Client.performRequest, which returns aResponsefor all HTTP statuses < 500 (including 400), and only throws anIOExceptionfor status ≥ 500. - Because
putWriteIndexMappingdoes not checkresponse.getStatusCode()and never throws on ≥ 300, a 400 mapping conflict is treated as success. updateDataAssetsDataStreamdepends on catching anIOExceptionto detect mapping conflicts and trigger rollover; since no exception is raised on 400, rollover is never executed on Elasticsearch.
Codebase Inconsistency
The OpenSearch DI client explicitly checks status and throws on ≥ 300, making the rollover recovery work there:
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/search/opensearch/OpenSearchDataInsightsClient.java:
try (var response = client.generic().execute(request)) {
int status = response.getStatus();
if (status >= 300) {
throw new IOException(
"Data Insights request PUT /" + name + "/_mapping failed with " + status);
}
}Recommended Fix
In ElasticSearchDataInsightsClient, check the returned Response status and throw on ≥ 300 (mirroring the OpenSearch implementation), at least for putWriteIndexMapping (and similarly for other ES DI methods where 4xx are currently silent):
Response response = client.performRequest(request);
int status = response.getStatusCode();
if (status >= 300) {
throw new IOException(
"Data Insights request PUT /" + name + "/_mapping failed with " + status);
}History
This bug was introduced in commit 664a4f6 (PR #33479, "fix(data-insights): rollover DI data stream after template update for AUT compatibility"). That commit added putWriteIndexMapping and the 400-driven rollover recovery, but putWriteIndexMapping never checked the HTTP status, so with Rest5Client’s non-throwing 4xx behavior the rollover recovery has been dead code on Elasticsearch since it was written.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity