Skip to content

Use a pagination to import dataΒ #74

@romainguerrero

Description

@romainguerrero

Is your feature request related to a problem? Please describe.
Actually the command typesense:import parse all collections and for each gets all entities to send them to the typesense instance. But if we have a lot of entities in a collection, the call could return an error 413 Request Entity Too Large depending on the server configuration.

Describe the solution you'd like
To avoid this issue, I suggest to update the ImportCommand to send data in batchs of 100 documents for example like it's done by the FOSElasticaBundle. As it's done in this previous bundle in the import of the AsyncPagerPersister (see "here":https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/src/Persister/AsyncPagerPersister.php#L55), the best solution could be to use a (configurable ?) pager for requesting entities in the database and send them in batchs.

Describe alternatives you've considered
An easier solution could be to still get all entities as done already but send data in batchs of 100 documents (or any configurable batch size ?) in the foreach loop. But I fear it could result on a memory limit error in case of huge entity number or size.

Additional context
Just for information here's the list of available options in the foselastica populate command :

  • max_per_page - Integer. Tells how many objects should be processed by a single worker at a time.
  • first_page - Integer. Tells from what page to start rebuilding the index.
  • last_page - Integer. Tells on what page to stop rebuilding the index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions