Skip to content

Commit f59e086

Browse files
committed
test: change testAddDocumentAcrossIndices
Since if_primary_term and if_seq_no are automatically set in getDocument, it is an error to add them to another Index as is. Therefore, convert the acquired document to an Array before calling
1 parent 527d4b7 commit f59e086

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/IndexTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,14 @@ public function testAddDocumentAcrossIndices(): void
569569

570570
$index1Doc = $index1->getDocument(1);
571571

572-
$index2->addDocument($index1Doc);
572+
// Since if_primary_term and if_seq_no are automatically set in getDocument,
573+
// it is an error to add them to another Index as is.
574+
// Therefore, convert the acquired document to an Array before calling
575+
$doc = new Document('1');
576+
$arr = $index1Doc->toArray();
577+
$doc->setData($arr['_source']);
578+
579+
$index2->addDocument($doc);
573580
$index2Doc = $index1->getDocument(1);
574581

575582
$this->assertEquals('Hello world', $index2Doc->get('title'));

0 commit comments

Comments
 (0)