# drop all indices from allCollections except those passed on the command line
    $allCollections = array_intersect_key($allCollections, array_flip($colls));
}
echo "\n\nCOLLECTIONS:\n" . json_encode($allCollections) . "\n\n\n\n";
$processedCollectionsCount = 0;
$debug_all_remaps = [];
$html = "";
foreach ($allCollections as $index => $params) {
    $processedCollectionsCount++;
    echo " # {$processedCollectionsCount}: PROCESSING {$index}\n ========================================================================================\n";
    if ($flags['--drop-index']) {
        DRIADAgent::deleteRemoteIndex($index);
    }
    echo "\n  Path: {$params['path']}\n";
    // get collection field list
    $fields = json_decode($ingester->getCollectionFieldInfo($index), true);
    $numFields = count($fields);
    //get fields array, with keys remapped as required by DRIAD
    $remap = DRIADAgent::getMappedFields($fields, count($fields), $params);
    // get items
    $payload = $ingester->query($index, 1);
    // equivalent to dmQueryTotalRecs
    $records = [];
    //these are the DMRecords (CISOPTRs, POINTERS, all the same thing)
    $iiif_recs = [];
    if ($flags['--add-item']) {
        $total = 1;
        $records[0] = ['pointer' => $flags['--add-item']];
        echo " Getting specific dmrecord: {$flags['--add-item']}";
    } else {
        $start = 0;