Bitbucket のコード検索インデックスを構成する

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

このページでは、Bitbucket Server (または Data Center) のコード検索インデックスのインデックス対象を構成する方法について説明します。Bitbucket のコード検索機能を提供する Elasticsearch によって使用されるディスク領域をご利用のインスタンスで削減したい場合に、この方法でメリットを実現できる場合があります。

ディスクの使用量を最適化するためには、さまざまなオプションを使用できます。選択すべき構成は要件に応じて異なりますが、フォークベースのワークフローを持つ組織の場合、コード検索のインデックス プロパティを変更することでメリットを実現できる場合がほとんどです。


Bitbucket のコード検索でのインデックス対象を変更する方法

  1. Locate the bitbucket.properties file in the <Bitbucket home directory>/shared directory. 

  2. In the bitbucket.properties file, set a value for the property plugin.search.codesearch.indexing.exclude=

    These are the options for configuring what code is indexed. You can only set one value at a time.

    説明
    all-forksフォークされたリポジトリにあるコードはコード検索結果に表示されません。
    personal-forks個人プロジェクトのフォークされたリポジトリにあるコードはコード検索結果に表示されません。
    synced-forksフォークされた、同期が有効化されたリポジトリにあるコードはコード検索結果に表示されません。
    undiverged-forkssynced-forks と同様ですが、デフォルト ブランチが変更された場合、フォークされたリポジトリ全体がインデックスされます。
  3. Bitbucket を再起動します。

  4. If you've changed to a more restrictive setting (eg no exclusions, to forks exclusion) then you'll need to kick off a manual reindex. We will not automatically remove your data from the index, and only by running the search sync job will data be removed. Elasticsearch should be running when you execute this command. This will iterate through your repositories and remove all those from Elasticsearch where they would otherwise not be indexed with your new setting. In our example case this would mean all repositories that were forks would have their repository content removed from the Elasticsearch instance

    curl -XPOST -H 'Content-Type: application/json' -H 'Accept: application/json' -u <adminUsername> http://<BitbucketURL>/rest/indexing/latest/sync

コード検索の無効化

You can also choose to disable code search entirely by changing the value of plugin.search.codesearch.indexing.enabled= to false. When code search is disabled, no repository content is indexed from the time at which the property is set. This does not disable Bitbucket's search box, or delete any existing indexes. Repository and project metadata will also still be indexed, allowing you to use the dashboard and search box's' repository quick search.

コード検索を無効化したあとにインデックスからデータを削除するには、検索の同期ジョブを実行する必要があります。次のコマンド経由で指定した場合を除き、Bitbucket はインデックスからのデータの削除を行いません。

curl -XPOST -H 'Content-Type: application/json' -H 'Accept: application/json' -u <adminUsername> http://<BitbucketURL>/rest/indexing/latest/sync

Bitbucket Server を使用するには引き続き Elasticsearch が必要です


最終更新日 2021 年 9 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.