protected function getFirst($result = [])
    {

        if (array_key_exists("hits", $result) && count($result["hits"]["hits"])) {

            $data = $result["hits"]["hits"];

            if ($this->model) {
                $model = new $this->model($data[0]["_source"], true);
            } else {
                $model = new Model($data[0]["_source"], true);
                $model->setConnection($model->getConnection());
                $model->setIndex($data[0]["_index"]);
                $model->setType($data[0]["_type"]);
            }

            // match earlier version

            $model->_index = $data[0]["_index"];
            $model->_type = $data[0]["_type"];
            $model->_id = $data[0]["_id"];
            $model->_score = $data[0]["_score"];

            $new = $model;

        } else {
            $new = NULL;
        }

        return $new;
    }