index() публичный Метод

Create a document.
public index ( string $indexName, string $type, array $data ) : array
$indexName string
$type string
$data array
Результат array
 public function testIndex()
 {
     $id = 11111;
     $data = ['id' => $id, 'name' => 'The Guardians of the Galaxy', 'year' => 2015];
     // Make sure the document doesn't exist.
     if ($this->documentsManager->exists('movies', 'movies', $id)) {
         $this->documentsManager->delete('movies', 'movies', $id);
     }
     $this->documentsManager->index('movies', 'movies', $data);
     $this->assertTrue($this->documentsManager->exists('movies', 'movies', $id));
     $this->assertEquals($data, $this->documentsManager->get('movies', 'movies', $id)['_source']);
 }
 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']);
 }