Code Search is not returning expected results
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:
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.
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:
plugin.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.