Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

AEK OAK Indexes in CodeBase

Avatar

Level 3

Hi Team,

 

Is there any way to address below issue:

 

We need to make our custom oak indexes as part of code base and property  "reindex" value is true. In this case after every code deploy, all indexes will run.

PROBLEM: How to make sure after every code deploy, these indexes do not run?

Is there any way to do it in more better way?

 

Regards,

KTNR

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @arvindpandey 
Are you AMS or AEMaaCS ?

AEMaaCS run reindexing before deploying the code.This deployment initiates two jobs, responsible for adding (and merging if necessary) the index definitions to MongoDB and Azure Segment Store for author and publish, respectively. Prior to the switch, the underlying repositories undergo reindexing with the updated index definitions.

 

Please check https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/index... 

 

However you can deploy index from code on AMS/On-Prem/AEMaaCS from code base



Arun Patidar

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

Hi @arvindpandey 
Are you AMS or AEMaaCS ?

AEMaaCS run reindexing before deploying the code.This deployment initiates two jobs, responsible for adding (and merging if necessary) the index definitions to MongoDB and Azure Segment Store for author and publish, respectively. Prior to the switch, the underlying repositories undergo reindexing with the updated index definitions.

 

Please check https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/index... 

 

However you can deploy index from code on AMS/On-Prem/AEMaaCS from code base



Arun Patidar

Avatar

Community Advisor

@arvindpandey can you please explain why you need to have reindex true property in codebase?

Avatar

Community Advisor

Hi @arvindpandey 

Absolutely, there are ways to address the issue of automatic reindexing after every code deployment with "reindex" set to true. Here are two approaches:

 

Use a Flag File:

  • Introduce a flag file within your codebase (e.g., a text file named oak_indexes_reindexed.flag).
  • During deployment, check for the existence of this flag file.
  • If the flag file doesn't exist, set the "reindex" property to true for your custom oak indexes and trigger the reindexing process.
  • Once reindexing is complete, create the flag file to indicate successful reindexing.
  • On subsequent deployments, if the flag file exists, skip setting "reindex" to true, thereby avoiding reindexing.

Also, there is another way to do the same : 

 

  • Set "reindex" to false by default: This avoids unnecessary reindexing after every deployment.
  • Implement a mechanism to trigger reindexing manually or programmatically: This could be a script or functionality within your application that allows reindexing on demand when necessary (e.g., after significant data model changes).

Thanks

Avatar

Employee Advisor

If you are using AEM 6.x (and not AEM CS), you can use the Ensure Oak Index feature of ACS AEM Commons.

Avatar

Community Advisor

@arvindpandey Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Esteban Bustamante

Avatar

Level 2

Hi @arvindpandey 

 

reindex property should not be present in the repo for deploying.

 

May i know what AEM version are you using and specific reason for having this property in repo