Skip to content

Commit

Permalink
Merge pull request #431 from martiis/flush
Browse files Browse the repository at this point in the history
added flush flag for connection commit method
  • Loading branch information
Martynas Sudintas committed Sep 29, 2015
2 parents 14ab67d + a6b8956 commit c9b7a62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Client/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,17 @@ public function setBulkParams(array $params)
}

/**
* Flushes the current query container to the index, used for bulk queries execution.
* Transmits the current query container to the index, used for bulk queries execution.
*
* @param bool $flush Flag for executing flush.
*/
public function commit()
public function commit($flush = true)
{
$this->bulkQueries = array_merge($this->bulkQueries, $this->bulkParams);
$this->getClient()->bulk($this->bulkQueries);
$this->flush();
if ($flush) {
$this->flush();
}

$this->bulkQueries = [];
}
Expand Down

0 comments on commit c9b7a62

Please sign in to comment.