public function index($indexName, $type, array $data)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'body'  => $data
		];

		// If an ID exists in the data set, use it, otherwise let elasticsearch generate one.
		if (array_key_exists('id', $data)) {
			$params['id'] = $data['id'];
		}

		return $this->elasticSearcher->getClient()->index($params);
	}
public function index($indexName, $type, array $data)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'body'  => $data
		];

		// If an ID exists in the data set, use it, otherwise let elasticsearch generate one.
		if (array_key_exists('id', $data)) {
			$params['id'] = $data['id'];
		}

		return $this->elasticSearcher->getClient()->index($params);
	}
public function index ( $ indexName , $ type , array $ data ) { $ index = $ this -> elasticSearcher -> indicesManager ( ) -> getRegistered ( $ indexName ) ; $ params = [ 'index' => $ index -> getInternalName ( ) , 'type' => $ type , 'body' => $ data ] ; // If an ID exists in the data set, use it, otherwise let elasticsearch generate one. if ( array_key_exists ( 'id' , $ data ) ) { $ params [ 'id' ] = $ data [ 'id' ] ; } return $ this -> elasticSearcher -> getClient ( ) -> index ( $ params ) ; }
Create a document.

@return array

@param string $indexName
@param string $type
@param array  $data
Create a document .