exists() public method

public exists ( string $indexName, string $type, string $id ) : boolean
$indexName string
$type string
$id string
return boolean
 public function testWithPrefixedIndex()
 {
     $id = 12345;
     $data = ['id' => $id, 'name' => 'Harry Potter and the wizards'];
     // Make sure the document doesn't exist.
     if ($this->documentsManager->exists('books', 'books', $id)) {
         $this->documentsManager->delete('books', 'books', $id);
     }
     $this->documentsManager->index('books', 'books', $data);
     $this->assertTrue($this->documentsManager->exists('books', 'books', $id));
     $this->assertEquals($data, $this->documentsManager->get('books', 'books', $id)['_source']);
 }
 public function testUpdateOrIndex()
 {
     $id = 12345;
     // Make sure the document doesn't exist.
     if ($this->documentsManager->exists('movies', 'movies', $id)) {
         $this->documentsManager->delete('movies', 'movies', $id);
     }
     $this->documentsManager->updateOrIndex('movies', 'movies', $id, ['id' => $id, 'name' => 'Jurasic World', 'year' => 2014]);
     $this->assertTrue($this->documentsManager->exists('movies', 'movies', $id));
     $this->documentsManager->updateOrIndex('movies', 'movies', $id, ['id' => $id, 'name' => 'Jurasic World', 'year' => 2015]);
     $document = $this->documentsManager->get('movies', 'movies', $id);
     $this->assertEquals('2015', $document['_source']['year']);
 }