Smarter Search for Bitbucket requires that your server use git 1.8.5 or higher.

Smarter Search for Bitbucket is powered by Elasticsearch. Either an internal or external node can be used. This node handles all search requests and all repository indexing.

If you want to use an external node, you must use Elasticsearch 2.1.1.

Internal Node

By default, Smarter Search for Bitbucket spawns an internal elasticsearch node. The initial indexing of large repositories can potentially require a large portion of RAM. It is recommended to allocate Bitbucket 6GB of RAM for optimal performance. For instructions on changing the amount of memory available to Bitbucket, take a look at Altassian's documentation here.

As an example benchmark, Smarter Search for Bitbucket indexed the Linux code base which is approximately 15 million lines of code and half a million commits in 2-3 minutes with 6 GB of ram on non-SSD hard drives with an internal node. That said, it is recommended that for large codebases you use an external Elasticsearch node. For any concerns or questions, feel free to contact us.

External Node

For Bitbucket instances with large codebases and a lot of indexing, it's recommended to setup a separate Elasticsearch service. This will reduce the strain on Bitbucket for indexing, and should significantly improve performance. You can configure an external node in the settings page.

Installing

Internal Node

After installing the plugin in your bitbucket instance, you must enable indexing and trigger a reindex:

  1. Go to Smarter Search for Bitbucket Global Settings page in the Bitbucket admin panel.

  2. Enable Indexing by clicking the check box.

  3. Click Save and Reindex to save the settings and subsequently reindex all repositories.

External Node

You must first setup an external Elasticsearch cluster. For help on that, look here. Make sure you install the Delete By Query plugin as well. The scripts we've included will do this for you. Smarter Search for Bitbucket has a configuration page in the global settings to use to point to your Elasticsearch instance.

enter image description here

For testing purposes, we've provided some scripts for installing and running an elasticsearch instance. You can obtain an instance of Elasticsearch by running the provided bin/install-elasticsearch-instance.sh script. To run an Elasticsearch instance, run bin/invoke-es.sh. Make sure that elasticearch.yml is in the directory you are invoking Elasticsearch in so that the Elasticsearch configuration is picked up.

Once the node is setup, you must configure Smarter Search for Bitbucket:

  1. Go to Smarter Search for Bitbucket Global Settings page in the Bitbucket admin panel.

  2. Enable Indexing by clicking the check box.

  3. Uncheck the Internal ES Node checkbox.

  4. Click Save and Reindex to save the settings and subsequently reindex all repositories.

Smarter Search for Bitbucket will then start indexing all of your bitbucket repositories in the background. It will take a few seconds to a few minutes to finish depending on the number and size of your repositories. For large Bitbucket instances, it is recommend indexing to be done during non peak hours.

By default, only the master and develop branches are indexed. Individual repo admins may modify these settings. See the Administration documentation page for instructions.