Skip to content

Commit cff5fd8

Browse files
committed
Map stats up to date with Es 7
1 parent dd83c0b commit cff5fd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Response/ResultMapper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,17 @@ public function mapStats(
239239
array $elasticSearchResponse
240240
) : Stats
241241
{
242+
$total = 0;
243+
if (\is_int($elasticSearchResponse['hits']['total'])) {
244+
$total = $elasticSearchResponse['hits']['total'];
245+
246+
} elseif (isset($elasticSearchResponse['hits']['total']['value'])) {
247+
$elasticSearchResponse['hits']['total']['value'];
248+
}
242249
return new Stats(
243250
$elasticSearchResponse['took'],
244251
$elasticSearchResponse['timed_out'],
245-
$elasticSearchResponse['hits']['total']
252+
$total
246253
);
247254
}
248255

0 commit comments

Comments
 (0)