This package is abandoned and no longer maintained. The author suggests using the ublaboo/datagrid package instead.

Elasticsearch DataSource for Ublaboo\DataGrid

v2.1.0 2020-09-10 11:29 UTC

This package is auto-updated.

Last update: 2020-11-16 12:14:49 UTC


Build Status Latest Stable Version License Total Downloads Gitter


There is no problem using Elasticsearch as a data source for contributte/datagrid.


Download this package using composer:

composer require ublaboo/datagrid-elasticsearch-data-source



namespace App\Presenters;

use Elasticsearch\Client;
use Nette\Application\UI\Presenter;
use Ublaboo\DataGrid\DataGrid;
use Ublaboo\DatagridElasticsearchDataSource\ElasticsearchDataSource;

final class UsersPresenter extends Presenter

	 * @var ElasticsearchDataSource
	private $elasticsearchDataSource;

	public function __construct(Client $client)
		$this->elasticsearchDataSource = new ElasticsearchDataSource(
			$client, // Elasticsearch\Client
			'users', // Index name
			'user' // Index type

	public function createComponentUsersGrid(): DataGrid
		$grid = new DataGrid;


		$grid->addColumnText('id', '#')->setSortable();
		$grid->addColumnLink('nickname', 'Nickname', 'edit')
		$grid->addColumnText('username', 'E-mail (username)')
		$grid->addColumnText('age', 'Age')
		$grid->addColumnText('status', 'Status')
				'active' => 'Active',
				'disabled' => 'Disabled',
		$grid->addColumnDateTime('created', 'Created')
			->setFormat('j. n. Y H:i:s')

		return $grid;