Remote OpenSearch instance fails to create indexes for Bitbucket Data Center.

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The OpenSearch instance, which is configured remotely, is experiencing issues with creating indexes for the Bitbucket Data Center. Although the remote instance has been set up successfully and has established a connection with Bitbucket, the process of creating indexes has failed. Consequently, search functionality within Bitbucket Data Center remains unavailable.

Environment

Diagnosis

The below error is seen in Bitbucket logs:

1 2 3 4 5 6 023-02-22 15:51:36,119 ERROR [search-indexing:thread-1] c.a.b.i.s.i.e.DefaultIndexEventWorker Indexing - Failed for repository PRJ/repo (id: 285) with error: Indexing for repository with id 285 failed and should be retried com.atlassian.bitbucket.internal.search.indexing.exceptions.IndexException: Indexing for repository with id 285 failed and should be retried at com.atlassian.bitbucket.internal.search.indexing.indexer.DefaultIndexService.lambda$updateIndexStateForError$26(DefaultIndexService.java:457) ... Caused by: java.lang.IllegalStateException: Object content expected to have '_type' field, but was not present; present fields: _index, _id, _version, result, _shards, _seq_no, _primary_term, status at com.atlassian.elasticsearch.client.content.ObjectContent.lambda$getOrThrow$5(ObjectContent.java:110)

Cause

Based on the error message, it appears that OpenSearch is expecting a specific field named '_type' that is not present in the payload sent by Bitbucket. This results in the java.lang.IllegalStateException and fails the index creation. In summary, it appears that there is an incompatibility issue between the version of OpenSearch being used and Bitbucket.

Solution

We recommend double-checking the supported platforms documentation for the version of Bitbucket that you are currently using. It is essential to ensure that you are using the compatible version of OpenSearch that aligns with the Bitbucket version. If the version is not compatible, we suggest upgrading or reinstalling the appropriate version of OpenSearch on your remote instance and reconnecting it with Bitbucket.

If the indexes have been migrated from Elastcisearch to OpenSearch and such issue happened, you can proceed with Rebuild the Search server indexes for Bitbucket Data Center

Updated on February 25, 2025

Still need help?

The Atlassian Community is here for you.