public function testDelete() { $client = new Simples_Transport_Http(); $this->assertTrue($client->index(array('content' => 'Pliz, pliz, delete me !'), array('index' => 'twitter', 'type' => 'tweet', 'id' => 'test_get'))->ok); $delete_object = $client->delete(1, array('index' => 'twitter', 'type' => 'tweet')); $this->assertEquals('/twitter/tweet/1/', (string) $delete_object->path()); $this->assertEquals(true, $delete_object->ok); $res = $client->get(1, array('index' => 'twitter', 'type' => 'tweet')); $this->assertFalse($res->exists); }
public function testMultiple() { $client = new Simples_Transport_Http(array('index' => 'twitter', 'type' => 'tweet')); $client->index(array(array('id' => '1', 'value' => 'first'), array('id' => '2', 'value' => 'second')), array('refresh' => true)); $request = $client->get(array(1, 2)); $this->assertEquals('/_mget/', (string) $request->path()); $body = $request->body(); $this->assertEquals('1', $body['docs'][0]['_id']); $res = $request->execute(); $this->assertEquals(2, count($res->documents())); }