Code Search is not returning expected results

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

Problem

Running a search for a string is not returned in the results even though the criteria of being located within a file on the default branch has been met.

Diagnosis

Environment

  • Bitbucket Data Center running in AWS using the Amazon OpenSearch Service

Diagnostic Steps

The following can be seen in the atlassian-bitbucket.log file:

1 ERROR [io-pump:thread-12917] c.a.b.s.i.i.DefaultIndexService On next - expected status code 200 but got: 413

Cause

HTTP response 413 translates to Payload too large.

Looking at the AWS Documentation, there are network limits in place that correspond to the size/type of the OpenSearch instance.

Solution

Resolution or Workaround

Workaround #1

Configure the max batch size in bitbucket.properties to be less than the OpenSearch instance's limit.

For example, if the OpenSearch instance has a 10MB maximum size limit, set the following property to be a value in bytes that is less than 10MB - such as 7MB:

p

lugin.search.indexing.max.batch.size=7340032

Workaround #2

Change the OpenSearch instance type to use the appropriate network limit and trigger a full re-index.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.