Administer code search
Bitbucket Data Center allows you to search through your code to find exactly what you’re looking for right from the search bar. You can restrict your search results to a specific project or repository using search filters. You can also search for code in a particular language (for example, lang:java
) or with a particular file extension (for example, ext:css
). Learn more about Bitbucket search syntax.
This page explains how Bitbucket Data Center uses a search server, how to configure a search server to fit the needs of your organization, and provides some tips for troubleshooting common problems.
About search servers
Code search is powered by a search server, which indexes the content of Bitbucket repositories in real-time. The search server distribution supported by Bitbucket is OpenSearch.
Support for Elasticsearch was removed in Bitbucket Data Center 9.0. If you're planning to use an external search server, we recommend using OpenSearch.
Important details and requirements about Bitbucket and a search server
This section outlines important considerations for using Bitbucket and a search server.
- A search server is required to run Bitbucket Data Center (although code search can be disabled entirely if needed).
- For information on supported versions of search servers and Bitbucket, refer to Supported platforms.
You can configure what is indexed for code search to exclude various types of forked repositories to save disk space.
- Running a clustered Bitbucket Data Center installation requires a remote search server that you should install and configure.
- To configure an external OpenSearch server, see Install and configure a remote OpenSearch server. Another option is Amazon OpenSearch Service. To check which search server versions are supported now, see the Supported platforms page.
- A clustered Bitbucket Data Center installation can have only one remote connection to the shared search server for your cluster. This may be a standalone search server installation or a clustered installation behind a load balancer.
- Code search is not critical for high availability. However, it is possible run a cluster of search server nodes to achieve high availability, although Atlassian can't guarantee support for such a setup in the event you encounter issues.
Change the connection details for accessing the search server
There are two ways you can change the connection details Bitbucket uses to access the search server:
- Configure the details of your search server within the Bitbucket UI, or
- Configure the details of your search server within the
bitbucket.properties
file.
If a search server parameter is set from within the bitbucket.properties
file, it can't be edited later from the admin UI.
If you need to make changes to the search server configuration, edit the bitbucket.properties
file, and then restart Bitbucket.
Use a remote search server with Bitbucket
A Bitbucket Data Center installation requires a remote search server, as no search server is bundled or installed for Bitbucket Data Center.
For instructions on setting up a single remote instance of OpenSearch to use with Bitbucket, see Install and configure a remote OpenSearch server.
For guidance on using a clustered search server installation with Bitbucket Data Center, including Amazon OpenSearch Server, see Use a clustered search server with Bitbucket Data Center.
Troubleshooting and frequently asked questions about the search server
I can't configure search server settings from the UI because the fields are grayed out
Your search server was configured using the bitbucket.properties
file. If a parameter is set in the bitbucket.properties
file, it cannot be edited later from the admin UI. If you need to make changes to the search server configuration, edit the bitbucket.properties
file, and then restart Bitbucket.
My remote search server is using up a lot of disk space
You can configure the search indexes to exclude certain types of forked repositories, which can save disk space when your company uses a fork-based workflow for development. To change what is indexed for code search, see Configuration properties for the options available to change what is indexed for code search. Note that excluding content from being indexed can prevent such content from ever appearing in code search results, but will not prevent the repositories themselves from appearing in search results.
I need to disable code search entirely
If you need to turn off code search for all of your Bitbucket users, you can disable code search entirely from within the bitbucket.properties
file. See the page Configuration properties for details.
Is a search server/code search required to run Bitbucket Data Center?
Yes. A search server is required to run Bitbucket Data Center (although code search can be disabled entirely if needed).
Can I use the bundled search server with a clustered Bitbucket Data Center?
No. Clustered Bitbucket Data Center requires a remote search server as each Bitbucket node must connect to the same external search server.
Bundled search was removed in Bitbucket 10. Use an external search server instead.
Can I use a clustered installation of a search server with Bitbucket Data Center?
Yes, however, Bitbucket Data Center can have only one remote connection to the shared search server for your cluster. This may be a search server installation or a clustered installation behind a load balancer. For guidance on using a clustered search server installation with Bitbucket Data Center, see the page Use a clustered search server with Bitbucket Data Center.
How do I secure my remote search server?
Atlassian strongly recommends you secure access to your remote search server with a username and password, and a minimum of basic HTTP authentication. See Secure your search server for details.