/** * @group functional */ public function testRawDocumentDataRequest() { $index = $this->_createIndex(); $type = $index->getType('bulk_test'); $client = $index->getClient(); $documents = array(new Document(null, '{"name":"Mister Fantastic"}'), new Document(null, '{"name":"Invisible Woman"}'), new Document(null, '{"name":"The Human Torch"}')); $bulk = new Bulk($client); $bulk->addDocuments($documents); $bulk->setType($type); $expectedJson = '{"index":{}} {"name":"Mister Fantastic"} {"index":{}} {"name":"Invisible Woman"} {"index":{}} {"name":"The Human Torch"} '; $expectedJson = str_replace(PHP_EOL, "\n", $expectedJson); $this->assertEquals($expectedJson, $bulk->toString()); $response = $bulk->send(); $this->assertTrue($response->isOk()); $type->getIndex()->refresh(); $response = $type->search(); $this->assertEquals(3, $response->count()); foreach (array('Mister', 'Invisible', 'Torch') as $name) { $result = $type->search($name); $this->assertEquals(1, count($result->getResults())); } }