Skip to content

Commit fbbf6a0

Browse files
committed
Fix the test suite, make sure _id is set before using
1 parent 175904b commit fbbf6a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/ElasticquentTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,10 @@ public function newFromHitBuilder($hit = array())
612612
$key_name = $this->getKeyName();
613613

614614
$attributes = $hit['_source'];
615-
$attributes[$key_name] = is_numeric($hit['_id']) ? intval($hit['_id']) : $hit['_id'];
615+
616+
if (isset($hit['_id'])) {
617+
$attributes[$key_name] = is_numeric($hit['_id']) ? intval($hit['_id']) : $hit['_id'];
618+
}
616619

617620
// Add fields to attributes
618621
if (isset($hit['fields'])) {

src/config/elasticquent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
| Elasticquent models.
2828
*/
2929

30-
'default_index' => 'default',
30+
'default_index' => 'my_custom_index_name',
3131

3232
);

0 commit comments

Comments
 (0)