-
Notifications
You must be signed in to change notification settings - Fork 189
Closed
Description
For example, for the given document
<?php
namespace Acme\AcmeDemoBundle\Document;
use ONGR\ElasticsearchBundle\Annotation as ES;
use ONGR\ElasticsearchBundle\Document\DocumentInterface;
use ONGR\ElasticsearchBundle\Document\DocumentTrait;
/**
* @ES\Document
*/
class Content implements DocumentInterface
{
use DocumentTrait;
/**
* @var string
*
* @ES\Property(name="name", type="string")
*/
private $name;
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}If you create one
$manager = $this->get("es.manager");
$content = new \Acme\AcmeDemoBundle\Document\Content();
$content->setId("myCustomId");
$content->setName("Acme");
$manager->persist($content);
$manager->commit();When you try to update an existing document you never can update it
$manager = $this->get("es.manager");
$repository = $manager->getRepository('AcmeDemoBundle:Content');
$document = $repository->find('myCustomId');
$content->setName("Another Name");
$manager->persist($document); // The persist method never send an "update" bulk operation to elasticsearch
$manager->commit();And look in the index
curl -XGET localhost:9200/my_index/my_type/_search?prettyThe content never change. I think that the problem is in the persist method of the Manager class https://github.com/ongr-io/ElasticsearchBundle/blob/master/ORM/Manager.php#L103-L107 that always sends the "create" operation. The Connection class never send any update option upsert, doc_as_upsert ... in the bulk method https://github.com/ongr-io/ElasticsearchBundle/blob/master/Client/Connection.php#L93-L115
Metadata
Metadata
Assignees
Labels
No labels