Download the PHP package vadiktok/rabbitmq-elastica-bundle without Composer
On this page you can find all versions of the php package vadiktok/rabbitmq-elastica-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rabbitmq-elastica-bundle
RabbitMQ Elastica Bundle
As you probably know Elastica populate command is very slow and unstable.
This bundle provides simple functionality to populate Elastica indexes using RabbitMQ bundle
General idea was taken from Enqueue Elastica Bundle
Installation
1)
2) Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:
3) Define RabbitMQ producer and consumer in your app/config.yml file:
Usage
1) Run elastica populate command with --pager-persister option set to "rabbitmq"
Also you might want to use --max-per-page option. By default it is set to 100 and in my case 20k worked perfectly.
This command simply creates MQ messages with number of pages, amount of results and index name/type. Consumer takes care about fetching results and pushing into Elasticsearch server.
One page equals one message in queue. So if you have 1m records and set --max-per-page to 10k -- you will have 100 messages published.
2) Consume your messages with
The more consumers you run -- the faster your indexes will be populated. According to my experience reasonable amount of consumers is from 5 to 10.
Also I recommend to use SupervisorD for that.
Configuration
By default bundle will look at vadiktok_elastica
producer and publish all messages to it.
But you may also want to modify that name. In this case just add this into your config.yml file:
Or even more. Imagine you want to split your indexes into different queues. All you have to do is define your consumers/producers same that is described in Installation section and then tell the bundle which producer to use:
Now imagine you need your new data first instead of waiting to index data from the first record. All you have to do is to add "order" parameter:
All versions of rabbitmq-elastica-bundle with dependencies
friendsofsymfony/elastica-bundle Version ^5.0
php-amqplib/rabbitmq-bundle Version ^1.11