Elasticsearch
Using Display Page Templates
ご覧のページは、お客様の利便性のために一部機械翻訳されています。また、ドキュメントは頻繁に更新が加えられており、翻訳は未完成の部分が含まれることをご了承ください。最新情報は都度公開されておりますため、必ず英語版をご参照ください。翻訳に問題がある場合は、 こちら までご連絡ください。

Elasticsearchへの接続

Elasticsearch を セットアップした後、Liferay Connector to Elasticsearch を使用して Liferay に接続します。 接続の手順は、設定するコネクターによって異なります。 参考として、 利用可能な Liferay Elasticsearch コネクタ を参照してください。

インストールおよび設定手順における顕著な違いはここに示されています。

.learn-article-nav-parent span { font-weight: 700; } .learn-article-page-container { padding: 0 1.5rem 1.5rem 1.5rem; } .liferay-nav-item-border { border-bottom: 1px solid #E2E2E4; } .liferay-nav-item-right-arrow { background-color: currentColor; display: inline-block; height: 16px; mask-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5593 7.32801L6.44914 3.27799C5.60571 2.48472 4.46015 3.56307 5.2847 4.34085L9.00776 8.00043L5.26267 11.7003C4.49477 12.4223 5.67809 13.4821 6.44914 12.757L10.5687 8.69764C11.1006 8.20804 11.1887 7.91057 10.5593 7.32801Z'/%3E%3C/svg%3E"); mask-repeat: no-repeat; mask-size: contain; transition: transform 0.3s ease-in-out; width: 16px; } .menu-nav-items-capabilities.show, .menu-nav-items-documentation.show { display: flex !important; flex-direction: column; } .menu-trigger { cursor: pointer; } .menu-trigger.show .liferay-nav-item-right-arrow { transform: rotate(90deg); } .table-of-contents-documentation { display: none; } .table-of-contents-documentation, .menu-trigger-capabilities { align-items: center; justify-content: space-between; } .table-of-contents-documentation span { font-weight: 700; } .learn-article-nav-parent { border-bottom: 1px solid #E2E2E4; padding: 8px; } .primary-item-toc { align-items: center; border-radius: 8px; display: flex; gap: 12px; padding: 8px 12px !important; width: 100% !important; } .primary-item-toc svg { margin-top: 0; } .primary-item-toc:hover { background-color: var(--color-action-neutral-hover-10, #eaecee); color: var(--color-action-primary-hover, #0053f0) !important; transition: box-shadow 0.1s linear, background-color 0.1s linear; } .primary-item-toc .liferay-nav-item-right-arrow { display: none; } .learn-article-nav-item .liferay-nav-item { align-items: center; display: flex; justify-content: space-between; width: 100%; } .liferay-nav-item { margin-top: 5px; } @media (max-width: 1024px) { .learn-article { padding: 0 !important; } .learn-article-content-container, .learn-article-page-container { flex-direction: column !important; } .learn-article-nav-container { max-width: 100% !important; } .learn-article-nav-content { margin-bottom: 40px; } .learn-article-nav-parent .primary-item-toc svg{ display: none; } .learn-article-page-container { padding: 0; } .menu-nav-items-capabilities, .menu-nav-items-documentation { display: none; } .menu-trigger-capabilities { justify-content: space-between !important; padding: 8px; } .menu-trigger-capabilities .liferay-nav-item-right-arrow { display: flex !important; } .table-of-contents-documentation { display: flex; padding: 16px 18px; } .primary-item-toc .liferay-nav-item-right-arrow { display: flex; } .primary-item-toc { justify-content: space-between; } .primary-item-toc:hover { background: none; color: var(--color-neutral-10, #282934) !important; } } @media (min-width: 1025px) { .learn-article-nav-parent .primary-item-toc { display: flex; } .menu-nav-items-capabilities, .menu-nav-items-documentation { display: flex !important; flex-direction: column; } .menu-trigger-capabilities .liferay-nav-item-right-arrow, .menu-trigger-documentation .liferay-nav-item-right-arrow { display: none !important; } }
<div class="adm-body"> <ul> <li> <p><em>Elasticsearch 7 の</em>システム設定エントリおよび対応する設定ファイルは、Elasticsearch 8 への接続設定にも使用されます。</p> </li> <li> <p>接続を設定する前に、各Liferayサーバーノードを停止します。</p> </li> <li> <p>Elasticsearch 7.17.xサーバーへのLiferayの接続は、<a href="https://help.liferay.com/hc/en-us/articles/35072800462733">Elasticsearch 7.17のサポート終了に</a>伴い、非推奨となります。 非推奨のElasticsearchに接続すると、ログと検索管理パネルに警告が表示されます。</p> <pre><code class="language-shell">WARN [main][ElasticsearchSearchEngine:382] Connecting to Elasticsearch 7 nodes is now deprecated. Upgrade the Elasticsearch nodes corresponding to the following connection IDs: __REMOTE__. </code></pre> </li> </ul> </div> </div> <p>Liferay 7.2 を使用している場合は、 <a href="#liferay-72-installing-elasticsearch-7-connector">Liferay 7.2: Elasticsearch 7 コネクタのインストール</a> に進んでください。</p> <h2 id="configuring-the-connector"><a href="#コネクタの設定" id="configuring-the-connector">コネクタの設定</a></h2> <p>Liferay DXP 2026.Q1+ 用の Elasticsearch コネクタは、以下の設定ファイルを使用して構成できます。</p> <pre><code>com.liferay.portal.search.elasticsearch8.configuration.ElasticsearchConfiguration.config </code></pre> <p>Liferay 7.3-2025.Q4 用の Elasticsearch コネクタは、以下の設定ファイルを使用して構成できます。</p> <pre><code>com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config </code></pre> <p>この同じファイルを使用して、Liferay 7.3および7.4をElasticsearch 7または8に接続することもできます。 利用可能な Elasticsearch バージョンを確認するには、 <a href="https://help.liferay.com/hc/en-us/articles/360016511651">検索エンジン互換性マトリックス</a> を参照してください。</p> <p>デプロイするには、 <code>[Liferay Home]/osgi/configs/</code> に配置します。</p> <p>Dockerの場合、</p> <pre><code class="language-bash">docker cp ~/path/to/com.liferay.portal.search.elasticsearch8.configuration.ElasticsearchConfiguration.config [container]:/mnt/liferay/files </code></pre> <p>または、ユーザーインターフェイスでコネクタを設定することもできます。 グローバルメニュー(<img src="https://resources.learn.liferay.com/images/dxp/latest/en/images/icon-applications-menu.png" alt="Global Menu" />)で、コントロールパネル→システム設定に進み、 <em>検索</em> カテゴリを開きます。 このエントリはElasticsearch 7と呼ばれます。</p> <p>シンプルな Elasticsearch コネクタ構成では、プロダクション モード (<code>productionModeEnabled=&quot;true&quot;</code>) を有効にし、各 Elasticsearch ノードへの URL (<code>networkHostAddresses=[&quot;http://es-node:9200&quot;]</code> ) を設定します。</p> <ol> <li> <p>お使いのバージョンに適した <a href="./elasticsearch-connector-configuration-reference#configuration-files-and-system-settings-entries">設定ファイル</a> を作成してください。 例えば、これはLiferay DXP 2026.Q1+の場合です。</p> <pre><code>com.liferay.portal.search.elasticsearch8.configuration.ElasticsearchConfiguration.config </code></pre> </li> <li> <p><code>.config</code>ファイルで設定プロパティを指定します。 以下は、 <a href="./securing-elasticsearch">セキュリティプロパティ</a> をコメントアウトした例です(暗号化が有効になっている場合は、 <code>https</code> ネットワークホストアドレスを使用する必要があることに注意してください)。</p> <pre><code class="language-properties"># In CE/DXP 7.3+, productionModeEnabled replaces operationMode (deprecated): productionModeEnabled=B&quot;true&quot; networkHostAddresses=[&quot;http://es-node1:9200&quot;,&quot;http://es-node3:9201&quot;,&quot;http://es-node3:9202&quot;] # In CE/DXP 7.3+ the security settings are included in the ElasticsearchConfiguration # In CE/DXP 7.2 the security settings go in com.liferay.portal.search.elasticsearch7.configuration.XPackSecurityConfiguration.config # Authentication #authenticationEnabled=B&quot;true&quot; #username=&quot;elastic&quot; #password=&quot;liferay&quot; # TLS/SSL #networkHostAddresses=[&quot;https://es-node1:9200&quot;,&quot;https://es-node3:9201&quot;,&quot;https://es-node3:9202&quot;] #httpSSLEnabled=B&quot;true&quot; #truststoreType=&quot;pkcs12&quot; #trustStorePath=&quot;/PATH/TO/elastic-nodes.p12&quot; #trustStorePassword=&quot;liferay&quot; # Highly recommended for all non-prodcution usage (e.g., practice, tests, diagnostics): #logExceptionsOnly=&quot;false&quot; </code></pre> </li> <li> <p><code>.config</code>ファイルを<code>[Liferay Home]/osgi/configs</code>フォルダに配置します。</p> </li> </ol> <div class="adm-block adm-tip"> <div class="adm-heading"> <svg class="adm-icon"><use xlink:href="#adm-tip" /></svg><span>ヒント

コネクタには多くの設定項目があります。 定義については、 Elasticsearch コネクタ設定 を参照してください。 ほとんどの設定は、 Elasticsearch で利用可能な設定に対応しています。

Elasticsearchサーバーを名前で参照するには、各Elasticsearchサーバー名をDNSまたはLiferayサーバーの/etc/hosts ファイル内のIPアドレスにマップします。

ヒント

ネットワークホストアドレスの形式は http[s]://[ホスト名]:[ポート] です。 Liferay Dockerコンテナを使用している場合は、 --add-host [ホスト名]:[IPアドレス] オプションを docker run コマンドで使用することで、ホスト名を各ElasticsearchサーバーのIPアドレスにマッピングできます。 ポートは、Elasticsearchコンテナのdocker runコマンドで -p 1234:5678 オプションの最初の値として定義されます(この場合は 1234 です)。 HTTPS が有効になっていないローカル テスト環境を実行している場合、すべてのアドレスは http://localhost:port になります。 詳細については、 Docker のドキュメント を参照してください。

Liferay 7.2:Elasticsearch 7コネクタのインストール

Elasticsearch 6コネクタを停止する

Liferay 7.2では、バンドルされているコネクタアプリケーションとAPIはElasticsearch 6用です。 Elasticsearch 7コネクタをインストールする前に、これらを無効にする必要があります。

  1. 以下のようなファイルを作成します。

    com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config
    
  2. 以下のコンテンツをファイルに追加します。

    blacklistBundleSymbolicNames=[ \
    	"com.liferay.portal.search.elasticsearch6.api", \
    	"com.liferay.portal.search.elasticsearch6.impl", \
    	"com.liferay.portal.search.elasticsearch6.spi", \
    	"com.liferay.portal.search.elasticsearch6.xpack.security.impl", \
    	"Liferay Connector to X-Pack Security [Elastic Stack 6.x] - Impl", \
    	"Liferay Enterprise Search Security - Impl.lpkg" \
    ]
    
  3. ファイルを[Liferay Home]/osgi/configsフォルダに配置します。

    Liferayサーバーを起動すると(まだ起動していない場合)、Liferayはこのファイルを読み取り、宣言されたバンドルの起動をブロックします。

    ヒント

    Docker: Liferay Home および Liferay インストールのその他の重要なフォルダーは、 /mnt/liferay にある Docker コンテナで、 ここ で説明されているようにアクセスできます。 docker cp /path/to/local/file [container_name]:/mnt/liferay/files/osgi/configs を使用して、設定ファイルをコンテナ内に配置できます。 後で、 docker cp を使用して、Liferay Connector を Elasticsearch 7 LPKG ファイルにデプロイできます。

    
    

### Elasticsearch 7コネクタのインストール

  1. Liferay Connector to Elasticsearch 7をダウンロードします。

    コネクタがElasticsearchのバージョンに対応していることを確認してください。 コネクタアプリケーションが新しいバージョン(7.18.0など)をサポートしている場合でも、コネクタのクライアントライブラリが古いバージョンのElasticsearch(7.17.1など)用である可能性があることに注意してください。 Liferayは、Elasticsearchのマイナーバージョンごとにコネクタをテストし、必要に応じて新しいアップデートコネクタバージョンを作成します。 いつものように、コネクタの互換性については、 検索エンジン互換性マトリックス を参照してください。

  2. LPKGをインストールします フォルダに配置して

    [Liferay Home]/deploy
    

    Dockerの場合、

    docker cp ~/path/to/Liferay\ Connector\ to\ Elasticsearch.lpkg [container]:/mnt/liferay/deploy
    

    Liferayサーバーを起動すると(まだ起動していない場合)、LiferayはLPKGをデプロイします。

これで、コネクタを設定する準備が整いました。

Liferay7.2用のコネクタを設定する

  1. 次のElasticsearch設定ファイルを作成します。

    com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
    
  2. .configファイルで設定プロパティを指定します。 ここでは、リモート動作モードを有効にし、各Elasticsearchノードのトランスポートアドレスを設定し、設定している接続を識別する例を示します。

    # com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
    operationMode="REMOTE"
    transportAddresses="ip.of.elasticsearch.node:9300"
    # Highly recommended for all non-production usage (e.g., practice, tests, diagnostics):
    #logExceptionsOnly="false"
    
  3. .configファイルを[Liferay Home]/osgi/configsフォルダに配置して、設定をデプロイします。

これでLiferayを開始する準備が整いました。

Liferayを起動して再インデックスを作成する

Elasticsearchが インストールされ、実行されている場合は、Liferayを起動します。 コントロールパネルで、[設定] → [検索機能]に移動し、Elasticsearch接続が有効であることを確認します。

検索管理パネルにアクティブな接続が表示されます。

検索インデックスとスペルチェックインデックスを再構築します。 [コントロールパネル] → [設定] → [検索機能]の[アクションをインデックスする]タブで、これらのアクションの両方を呼び出します。

Liferay 7.3以降では、ワークフローメトリクス設定ウィンドウから ワークフローメトリクス インデックスを再インデックスします。

  1. グローバルメニュー(Applications Menu)から、アプリケーション → ワークフローメトリクスに移動します。

  2. アプリオプションメニュー(App Options)から設定ウィンドウを開きます。

  3. すべてを再インデックス をクリックします。 この操作をシステム内の各仮想インスタンスに対して繰り返します。

Elasticsearch インデックスをプライマリ データ ストレージ (データベースによってバックアップされていないデータのストレージ) に使用している場合は、 スナップショットとリストアのアプローチ を使用して、そのデータを新しい Elasticsearch クラスターに取り込むことができます。 7.2と7.3では、Liferay独自の検索の調整インデックス(結果ランキングと同義語用)が、メインのストレージインデックスです。 7.4では、これらのインデックスはデータベーステーブルによってバックアップされています。

Liferay 7.4 U45+/GA45+ および Liferay DXP 7.3 U14+ では、拡張ログ機能が有効になっているため、システムインデックスと会社インデックスの再インデックスの開始と終了時刻を知ることができます。 例えば、

2023-01-09 20:44:17.730 INFO  [liferay/background_task-2][ReindexPortalBackgroundTaskExecutor:57] Start reindexing company 0
2023-01-09 20:44:53.677 INFO  [liferay/background_task-2][ReindexPortalBackgroundTaskExecutor:76] Finished reindexing company 0
2023-01-09 20:44:53.677 INFO  [liferay/background_task-2][ReindexPortalBackgroundTaskExecutor:57] Start reindexing company 20097
2023-01-09 20:45:00.986 INFO  [liferay/background_task-2][ReindexPortalBackgroundTaskExecutor:76] Finished reindexing company 20097

Liferayは現在、お客様のリモートElasticsearchインストール環境にコンテンツをインデックス化しています。

利用可能なLiferay Elasticsearchコネクタ

バンドルされているElasticsearchへのコネクタが、インストールに最適であるとは限りません。 Elasticsearchとの通信に使用できるコネクタ間の違いを理解することが重要です。

Liferay CE/DXPバージョン名前可用性通信プロトコルセキュアな接続のサポート動作モード
Liferay DXP 2026.Q1+Liferay Connector to Elasticsearch 8バンドルHTTP (Javaクライアント)Sidecar / Remote (Production)*
Liferay 7.4(2025年第4四半期まで)、全バージョンLiferay Connector to Elasticsearch 7バンドルHTTPSidecar / Remote (Production)*
CE 7.3 GA4+、DXP 7.3 GA1+Liferay (CE) Connector to Elasticsearch 7バンドルHTTPSidecar / Remote (Production)*
CE 7.2、DXP 7.2Liferay Connector (CE) to Elasticsearch 6バンドルトランスポート✔** ( LES が必要です)エンベデッド/リモート
CE 7.2、DXP 7.2Liferay Connector (CE) to Elasticsearch 7 (v3.x)マーケットプレイス: CEDXPトランスポートエンベデッド/リモート

* コネクタ構成の 操作モード (operationMode) 設定は非推奨となり、 生産モード有効化 (productionModeEnabled ) に置き換えられました。

** Liferay Enterprise Search Security アプリケーションを介して。

互換性のある Elasticsearch バージョンや必要なパッチ レベルなど、詳細な互換性情報については、 検索エンジン互換性マトリックス を参照してください。

次のステップ

LiferayがElasticsearchに接続されたので、Elasticsearchの使用を開始できます。 本番環境では、LiferayサーバーとElasticsearchサーバー間の通信を保護する必要があります。 詳細については、 Elasticsearch のセキュリティ保護 を参照してください。