addRawData() public method

public addRawData ( array $data )
$data array
コード例 #1
0
ファイル: Client.php プロジェクト: backplane/elastica
 /**
  * Bulk operation
  *
  * Every entry in the params array has to exactly on array
  * of the bulk operation. An example param array would be:
  *
  * array(
  *         array('index' => array('_index' => 'test', '_type' => 'user', '_id' => '1')),
  *         array('user' => array('name' => 'hans')),
  *         array('delete' => array('_index' => 'test', '_type' => 'user', '_id' => '2'))
  * );
  *
  * @throws \Elastica\Exception\ResponseException
  * @throws \Elastica\Exception\InvalidException
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
  *
  * @param  array                      $params Parameter array
  * @return \Elastica\Bulk\ResponseSet Response object
  */
 public function bulk(array $params)
 {
     if (empty($params)) {
         throw new InvalidException('Array has to consist of at least one param');
     }
     $bulk = new Bulk($this);
     $bulk->addRawData($params);
     return $bulk->send();
 }
コード例 #2
0
ファイル: BulkTest.php プロジェクト: MediaWiki-stable/1.26.1
 /**
  * @group unit
  * @dataProvider invalidRawDataProvider
  * @expectedException \Elastica\Exception\InvalidException
  */
 public function testInvalidRawData($rawData, $failMessage)
 {
     $bulk = new Bulk($this->_getClient());
     $bulk->addRawData($rawData);
     $this->fail($failMessage);
 }