src/Persister/DocumentPersister.php
public function exists(array $criteria): bool
    {
        $query = $this->prepareQuery($criteria);
        $query->setSize(0);
        $query->setParam('terminate_after', 1);

        return $this->collection->search($query)->count() > 0;
    }
public function exists(array $criteria): bool
    {
        $query = $this->prepareQuery($criteria);
        $query->setSize(0);
        $query->setParam('terminate_after', 1);

        return $this->collection->search($query)->count() > 0;
    }
public function exists ( array $ criteria ) : bool { $ query = $ this -> prepareQuery ( $ criteria ) ; $ query -> setSize ( 0 ) ; $ query -> setParam ( 'terminate_after' , 1 ) ; return $ this -> collection -> search ( $ query ) -> count ( ) > 0 ; }
Checks whether a document matching criteria exists in collection.

@param array $criteria

@return bool
Checks whether a document matching criteria exists in collection .