legacy-knowledge-base
公開されました Jun. 30, 2025

Elasticsearch にそのようなインデックスがないか、マッピングなしでインデックスが作成されました。

written-by

Daniel Martinez Cisneros

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

場合によっては、Elasticsearchのノードインデックスが不適切に作成され、ドキュメントが正常に注入されたように見えるが、ポータルでアセットを検索しようとすると何も見つからないということがあります。

com.liferay.portal.search パッケージのデバッグレベルを変更したにもかかわらず、エラーは表示されず、Elasticsearch のログには問題なくクエリが記録されています。

この問題は、Elasticsearchの関連インデックスのマッピングが正しくないために発生する可能性があります。

環境

  • Liferay DXP 7.0
  • Liferay DXP 7.1
  • Liferay DXP 7.2
  • Liferay DXP 7.3
  • Liferay DXP 7.4
  • 四半期リリース 2023.Q4

解像度

この問題を解決するには、以下の手順に従ってください:

  1. インデックスのマッピングを確認する:
    curl "http://${ip_elasticsearch}:9200/${prefix_index}-*/_mapping/LiferayDocumentType"
  2. Elasticsearch の action.auto_create_index プロパティが false になっていないか確認し、自動的にインデックスが作成されないようにします。
  3. 誤ったインデックスを削除する:

    curl -X DELETE "${ip_elasticsearch}:9200/${index_name}?pretty"
  4. 以下のgroovyスクリプトを使用して、erroneusインデックスに関連付けられた会社のインデックスを強制的に再作成します:

    /* Company to full reindex */
    def companyId = 59093686;
    def userId = java.lang.Long.parseLong(userInfo.get("liferay.user.id"));
    com.liferay.portal.kernel.search.IndexWriterHelperUtil.reindex(userId, "reindex", [companyId] as long[], null);
  5. インデックスのマッピングを再度確認する。 これで、その会社の資産を検索できるはずです。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base