Nightly index update with query rules

The business has recently added some query rules to our index, however, these are not being backed-up during the nightly backup. I plan to fix this by using a similar approach to the one we use to back-up synonyms:

  • Get all query rules from the index via searchRules (so we don’t need to know the object IDs)
  • Call saveRules method on the temp index with the results of searchRules

Can you confirm that this would be the right approach or is there something better?

Hi Amanda,

You may be interested in a “scoped” copy index: https://www.algolia.com/doc/api-reference/api-methods/copy-index/?language=python#scopes-parameter

As you can see you can this way copy all the rules or all the synonyms at once.
Refer to the documentation of the language you are using to know how you are supposed to specify it to copy_index.

Regards,

Thanks @leo.ercolanelli that sounds great - looks like I can just do a scoped copy_index of the query rules, synonyms and settings to the temp index and, after adding all the records, do the move_index(). That should simplify our nightly reindex.