public function deleteSearchDocumentsByTypeId($typeId, $timestamp = null)
    {
        $searchSpec = $this->getSearchDocumentSpecification($typeId);
        if ($searchSpec == null) {
            throw new \Tripod\Exceptions\SearchException("Could not find a search specification for $typeId");
        }
        $query = ['_id.type' => $typeId];
        if ($timestamp) {
            if (!($timestamp instanceof \MongoDB\BSON\UTCDateTime)) {
                $timestamp = new \MongoDB\BSON\UTCDateTime($timestamp);
            }
            $query['$or'] = [
                [\_CREATED_TS => ['$lt' => $timestamp]],
                [\_CREATED_TS => ['$exists' => false]]
            ];
        }
        $deleteResponse = $this->getCollectionForSearchSpec($typeId)
            ->deleteMany($query);
        return $deleteResponse->getDeletedCount();
    }