Phosphorum\Search\Indexer::parseElasticResponse PHP Method

parseElasticResponse() protected method

Parse Elasticsearch response
protected parseElasticResponse ( mixed $response ) : array
$response mixed
return array
    protected function parseElasticResponse($response)
    {
        if (!isset($response['hits']) || !isset($response['hits']['hits']) || !is_array($response['hits']['hits'])) {
            throw new \Exception('The Elasticsearch client does not return expected response.');
        }
        return $response['hits']['hits'];
    }