Skip to content

Commit

Permalink
Allow json string as data srouce for Bulk\Action on update
Browse files Browse the repository at this point in the history
  • Loading branch information
pentarim committed Mar 25, 2014
1 parent 0314dce commit 8810e1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changes.txt
@@ -1,5 +1,8 @@
CHANGES

2014-03-25
- Allow json string as data srouce for Bulk\Action on update

2014-03-20
- Allow for request params in delete by query calls #573

Expand Down
18 changes: 18 additions & 0 deletions test/lib/Elastica/Test/BulkTest.php
Expand Up @@ -558,6 +558,24 @@ public function testUpdate()
$doc = $type->getDocument(6);
$this->assertEquals('test', $doc->test);

//test updating via document with json string as data
$doc3 = $type->createDocument(2);
$bulk = new Bulk($client);
$bulk->setType($type);
$doc3->setData('{"name" : "Paul it is"}');
$updateAction = new \Elastica\Bulk\Action\UpdateDocument($doc3);
$bulk->addAction($updateAction);
$response = $bulk->send();

$this->assertTrue($response->isOk());
$this->assertFalse($response->hasError());

$index->refresh();

$doc = $type->getDocument(2);
$docData = $doc->getData();
$this->assertEquals('Paul it is', $docData['name']);

$index->delete();
}

Expand Down

0 comments on commit 8810e1f

Please sign in to comment.