src/ElasticsearchMock/Client.php
public function addSearchResult($index, $type, array $documents)
    {
        $result = [
            'took' => 5,
            'timed_out' => false,
            '_shards' => [ 'total' => 5, 'successful' => 5, 'failed' => 0 ],
            'hits' => [
                'total' => count($documents),
                'max_score' => 1,
                'hits' => []
            ]
        ];

        foreach ($documents as $document) {
            $result['hits']['hits'][] = [
                '_index' => $index,
                '_type' => $type,
                '_id' => $document['id'],
                '_score' => 1,
                '_source' => $document
            ];
        }

        return $this->addResult('search', $result);
    }
public function addSearchResult($index, $type, array $documents)
    {
        $result = [
            'took' => 5,
            'timed_out' => false,
            '_shards' => [ 'total' => 5, 'successful' => 5, 'failed' => 0 ],
            'hits' => [
                'total' => count($documents),
                'max_score' => 1,
                'hits' => []
            ]
        ];

        foreach ($documents as $document) {
            $result['hits']['hits'][] = [
                '_index' => $index,
                '_type' => $type,
                '_id' => $document['id'],
                '_score' => 1,
                '_source' => $document
            ];
        }

        return $this->addResult('search', $result);
    }
Add a search result

@param string $index
@param string $type
@param array  $documents

@return Client