Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented retrievement of id after commit() #589

Closed
wants to merge 2 commits into from

Conversation

einorler
Copy link
Member

closes #484

if (isset($this->persistedObjects)) {
$i = 0;
foreach ($this->persistedObjects as $document) {
$document->id = $bulkResponse['items'][$indexing[$i]]['create']['_id'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can not hardcode id property here. User is free to choose which property of a document he wants to use for Elasticsearch _id value (using @Id annotation).

You could get actual property from metadata collector.

@einorler
Copy link
Member Author

Thanks for that, I've taken it into account in the latest changes


if (isset( $mapping['aliases']['_id'])) {
$id_property = $mapping['aliases']['_id']['propertyName'];
$document->$id_property = $bulkResponse['items'][$indexing[$i]]['create']['_id'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property can be private :)

@saimaz
Copy link
Member

saimaz commented Jul 11, 2016

It's been remastered in #660 with grater performance.

@saimaz saimaz closed this Jul 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set document ID after commit to ES
3 participants