e1on / omines-datatables-elasticsearch-adapter-bundle
Elasticsearch adapter with search_after feature for DataTable Omines bundle
Package info
github.com/LoliE1ON/omines-datatables-elasticsearch-adapter-bundle
Type:symfony-bundle
pkg:composer/e1on/omines-datatables-elasticsearch-adapter-bundle
1.0.4
2024-03-26 17:12 UTC
Requires
- php: >=8.1
- omines/datatables-bundle: ^0.7.1
- symfony/framework-bundle: ^5.4|^6.3|^7.0
- symfony/property-access: ^5.4|^6.3|^7.0
Requires (Dev)
- ruflin/elastica: ^6.2|^7.3.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This bundle provides integration between Elasticsearch and the DataTable bundle for Symfony, enabling efficient querying of Elasticsearch indices and fetching results using the search_after feature. This allows for pagination and quick processing of large volumes of data presented in the DataTable format, leveraging the powerful search capabilities of Elasticsearch.
Install
composer require e1on/omines-datatables-elasticsearch-adapter-bundle
Rules
- Setting a name for a DataTable is required
- Uniq DataTable name for each table
Using
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-*', ]);