Cake\ElasticSearch\Type::exists PHP Method

exists() public method

Returns true if there is any record in this repository matching the specified conditions.
public exists ( array $conditions ) : boolean
$conditions array list of conditions to pass to the query
return boolean
    public function exists($conditions)
    {
        $query = $this->query();
        if (count($conditions) && isset($conditions['id'])) {
            $query->where(function ($builder) use($conditions) {
                return $builder->ids((array) $conditions['id']);
            });
        } else {
            $query->where($conditions);
        }
        $type = $this->connection()->getIndex()->getType($this->name());
        return $type->count($query->compileQuery()) > 0;
    }