At least one of Key, Label, Created or Updated attributes must be indexed for object type in Jira Data Center

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

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.


Environment

  • JSM Data Center 10.1 and any higher version


Diagnosis

  • 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.log
    2024-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.

    For 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);


    (info) The REMOVABLE column informs which are the 4 default fields for an Object Type, and TYPE 1 is the type assigned to an attribute that references an object.

  • If any rows are returned, proceed with the Solution steps below.

Cause

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.

Solution

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

"The Indexed feature on every attribute essentially helps you to retrieve your search results faster when you do a basic search or an advanced search using IQL anywhere (e.g, post functions, imports, custom fields etc). So the recommended practice is that for all IQL queries used at these multiple places, you should index your attributes.

If your attribute is indexed, Insight will not retrieve results from the database every time but instead retrieve them from an index/cache which yields results quicker. However, this comes at the cost of a higher memory consumption."

(warning) Before proceeding with the steps below, we always recommend that you create a native database backup, in case the changes need to be rolled back.

Detailed steps:

  1. Access the Jira database.
  2. 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.
    1. Set only the necessary attributes to be indexed:

      For 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;
    2. Set all attributes but 'textarea' types to be indexed:

      For Postgres:
      UPDATE "AO_8542F1_IFJ_OBJ_TYPE_ATTR" SET "INDEXED" = 'true' WHERE "DEFAULT_TYPE_ID" != 9 AND ("INDEXED" != 'true' OR "INDEXED" is NULL);
      MySQL:
      UPDATE 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;
      
      
  3. On Jira UI, go to Jira administration (gear icon) > Manage Apps > Indexing Assets.
  4. Run a Clean Assets Reindex


Last modified on Oct 4, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.