Using entityQuery in a drush command

Submitted bybarnettech onTue, 04/20/2021 - 10:20
      $result = \Drupal::entityQuery('group')
        ->condition('type', $type)
        ->range(0, 20000)
        ->accessCheck(FALSE)
        ->execute();

make sure to set accessCheck to FALSE or you'll get no results, entityQuery respects permissions and the drush user won't be running as any particular user.