At least one of Key, Label, Created or Updated attributes must be indexed for object type in Jira Data Center
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
Assets performs detailed analysis of the failed Assets objects and attempt to explain exactly why the object failed to be indexed. The following message is is displayed in Jira > Manage Apps > Indexing Assets section.
環境
- JSM Data Center 10.1 and any higher version
診断
In Jira > Manage Apps > Indexing Assets there is a warning message "At least one of Key, Label, Created or Updated attributes must be indexed for object type"
In the Atlassian log file, the following stack trace is present:
atlassian-jira.log2024-08-28 14:12:06,846 insight-InsightThreadGroup-worker-thread-12 WARN admin [i.r.i.i.m.ObjectIndexImpl] Could not load all objects in cache - loading one by one com.google.common.cache.CacheLoader$InvalidCacheLoadException: loadAll failed to return a value for 1 at com.google.common.cache.LocalCache.getAll(LocalCache.java:4091) ~[guava-33.2.1-jre.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getAll(LocalCache.java:5004) ~[guava-33.2.1-jre.jar:?] at io.riada.insight.index.model.InsightIndexBase.loadAll(InsightIndexBase.java:83) ~[6829635c-2b0e-43be-b422-d11715df9423_213.0:4/:?] at io.riada.insight.index.model.ObjectIndexImpl.reindexObjects(ObjectIndexImpl.java:396) ~[6829635c-2b0e-43be-b422-d11715df9423_213.0:4/:?] at com.riadalabs.jira.plugins.insight.services.core.index.ReindexServiceImpl$ReindexObjectsJob.executeTask(ReindexServiceImpl.java:779) ~[6829635c-2b0e-43be-b422-d11715df9423_213.0:26/:?] at com.riadalabs.jira.plugins.insight.services.core.index.ReindexServiceImpl$ReindexObjectsJob.executeTask(ReindexServiceImpl.java:751) ~[6829635c-2b0e-43be-b422-d11715df9423_213.0:26/:?] at com.riadalabs.jira.plugins.insight.services.core.multithreadservice.InsightServiceJob.call(InsightServiceJob.java:41) ~[6829635c-2b0e-43be-b422-d11715df9423_213.0:26/:?] at com.atlassian.jira.util.thread.JiraThreadLocalUtils.lambda$wrap$2(JiraThreadLocalUtils.java:194) ~[classes/:?] at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38) [jira-sal-plugin-10.1.0-QR-20240822132126_1724297090000.jar:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:840) [?:?] 2024-08-28 14:12:07,214 insight-InsightThreadGroup-worker-thread-12 ERROR admin [i.r.i.i.m.ObjectIndexImpl] Failed to reindex objects with IDs: [1, 86, 87, 88, 89, 90, 91] 2024-08-28 14:12:07,298 insight-InsightThreadGroup-worker-thread-10 ERROR admin [c.r.j.p.i.s.c.d.i.ObjectDalImpl] Cannot index Object ITSM-86 - Object type Computers(ID:5) is missing required indexed attributes Key, Created, Updated or Label
To diagnose this problem, we might look for the above-mentioned errors in the Jira logs and run the below query on the Jira database to verify the log exception.
Postgres の場合:SELECT "ID", "NAME", "REMOVABLE", "TYPE", "LABEL", "INDEXED" FROM "AO_8542F1_IFJ_OBJ_TYPE_ATTR" WHERE ("REMOVABLE" = 'false' OR "TYPE" = 1) AND ("INDEXED" != 'true' OR "INDEXED" is NULL);
For MySQL:SELECT ID, NAME, REMOVABLE, TYPE, LABEL, INDEXED FROM AO_8542F1_IFJ_OBJ_TYPE_ATTR WHERE (REMOVABLE = false OR TYPE = 1) AND (INDEXED != TRUE OR INDEXED IS NULL);
For MS SQL:SELECT ID, NAME, REMOVABLE, TYPE, LABEL, INDEXED FROM "AO_8542F1_IFJ_OBJ_TYPE_ATTR" WHERE (REMOVABLE = 0 OR TYPE = 1) AND (INDEXED != 1 OR INDEXED IS NULL);
REMOVABLE 列はオブジェクト タイプの 4 つの既定のフィールドを示し、TYPE 1 はオブジェクトを参照する属性に割り当てられたタイプを示します。- 行が返された場合は、後述の「解決方法」の手順に進んでください。
原因
Although the 'Label' and an Object type attribute, are the main causes for the error messages above, there are other attributes that Assets expects to be indexed, and cannot be disabled through the UI, that we should also take note of if running into this scenario, those being:
- The 4 fields that are created automatically for each object type (Key, Created, Updated & Label field).
- Any attribute that references another object.
This misconfiguration may not be caused by an operation permitted through the UI. It could result from direct tampering with the database or an unknown cause.
ソリューション
Since we cannot enable or disable the indexing of Label field (or any of the other fields mentioned at the Diagnostics section) through the Assets UI, we will need to apply the changes directly to the database, for all the required fields that are not yet indexed.
The default behavior for Assets is to index all attributes with the exception of the 'textarea', which is a very costly field to index. For this reason, we've included two options on the instructions below, one to only configure the necessary fields to be indexed, and the other to set all attributes to be indexed with the exception of the 'textarea' ones.
To better understand which is the option that you'd like to follow, you can check the explanation around indexing provided by Adding attributes to object types
「各属性に対するインデックス作成機能は、基本検索を行ったり、事後操作、インポート、カスタム フィールドなどの任意の場所で IQL による詳細検索を行ったりする場合に、検索結果をより速く取得するのに役立ちます。したがって、これらの複数の場所で使用されるすべての IQL クエリにおいて、属性にインデックスを作成することをお勧めします。
属性にインデックスを作成すると、Insight は毎回データベースから結果を取得するのではなく、インデックス/キャッシュから結果を取得するため、より迅速に結果が得られます。ただし、これにはメモリ消費量が増えるという代償が伴います。」
次の手順に進む前に、変更のロールバックが必要になった場合に備えて、常にネイティブ データベース バックアップを作成することをお勧めします。
詳細な手順:
- Jira データベースにアクセスします。
- Run one of the queries below to adjust the indexing flag for the Assets attributes, depending on which path you'd like to follow, and database type.
必要な属性に対してのみインデックスを作成するように設定します。
Postgres の場合:UPDATE "AO_8542F1_IFJ_OBJ_TYPE_ATTR" SET "INDEXED" = 'true' WHERE ("REMOVABLE" = 'false' OR "TYPE" = 1) AND ("INDEXED" != 'true' OR "INDEXED" is NULL);
For MySQL:UPDATE AO_8542F1_IFJ_OBJ_TYPE_ATTR SET INDEXED = true WHERE (REMOVABLE = false OR TYPE = 1) AND INDEXED != true;
For MS SQL:UPDATE AO_8542F1_IFJ_OBJ_TYPE_ATTR SET INDEXED = 1 WHERE (REMOVABLE = 0 OR TYPE = 1) AND INDEXED != 1;
"textarea" タイプを除くすべての属性に対してインデックスを作成するように設定します。
Postgres の場合:UPDATE "AO_8542F1_IFJ_OBJ_TYPE_ATTR" SET "INDEXED" = 'true' WHERE "DEFAULT_TYPE_ID" != 9 AND ("INDEXED" != 'true' OR "INDEXED" is NULL);
MySQLUPDATE AO_8542F1_IFJ_OBJ_TYPE_ATTR SET INDEXED = true WHERE DEFAULT_TYPE_ID != 9 AND INDEXED != true;
For SQL:UPDATE AO_8542F1_IFJ_OBJ_TYPE_ATTR SET INDEXED = 1 WHERE DEFAULT_TYPE_ID <> 9 AND INDEXED != 1;
- On Jira UI, go to Jira administration (gear icon) > Manage Apps > Indexing Assets.
- Run a Clean Assets Reindex