code: def refresh_identities(enrich_backend, author_field=None, author_values=None):
      def update_items(new_filter_author):
          for eitem in enrich_backend.fetch(new_filter_author):
              roles = None
              try:
                  roles = enrich_backend.roles
              except AttributeError:
                  pass
              new_identities = enrich_backend.get_item_sh_from_id(eitem, roles)
              eitem.update(new_identities)
              yield eitem
      logger.debug("Refreshing identities fields from %s",
                   enrich_backend.elastic.anonymize_url(enrich_backend.elastic.index_url))
      total = 0
      max_ids = enrich_backend.elastic.max_items_clause
      logger.debug('Refreshing identities')
      if author_field is None:
          for item in update_items(None):
              yield item
              total += 1
      else:
          to_refresh = []
          for author_value in author_values:
              to_refresh.append(author_value)
              if len(to_refresh) > max_ids:
                  filter_author = {"name": author_field,
                                   "value": to_refresh}
                  for item in update_items(filter_author):
                      yield item
                      total += 1
                  to_refresh = []
          if len(to_refresh) > 0:
              filter_author = {"name": author_field,
                               "value": to_refresh}
              for item in update_items(filter_author):
                  yield item
                  total += 1
      logger.info("Total eitems refreshed for identities fields %i", total)