PHP code example of e1on / omines-datatables-elasticsearch-adapter-bundle
1. Go to this page and download the library: Download e1on/omines-datatables-elasticsearch-adapter-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
e1on / omines-datatables-elasticsearch-adapter-bundle example snippets
use E1on\OminesDatatablesElasticsearchAdapterBundle\ElasticaAdapter;
$table = $this->createDataTable()
->setName('log')
->add('timestamp', DateTimeColumn::class, ['field' => '@timestamp', 'format' => 'Y-m-d H:i:s', 'orderable' => true])
->add('level', MapColumn::class, [
'default' => '<span class="label label-default">Unknown</span>',
'map' => ['Emergency', 'Alert', 'Critical', 'Error', 'Warning', 'Notice', 'Info', 'Debug'],
])
->add('message', TextColumn::class, ['globalSearchable' => true])
->createAdapter(ElasticaAdapter::class, [
'client' => ['host' => 'elasticsearch'],
'index' => 'logstash-*',
]);