diff --git a/cubicweb_elasticsearch/ccplugin.py b/cubicweb_elasticsearch/ccplugin.py index 56ae3afb23f2f2efee53510a44b2d1552d114b52_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9jY3BsdWdpbi5weQ==..1cfb8bd26fe6c26e97ef6463fae9f5074baddb82_Y3ViaWN3ZWJfZWxhc3RpY3NlYXJjaC9jY3BsdWdpbi5weQ== 100644 --- a/cubicweb_elasticsearch/ccplugin.py +++ b/cubicweb_elasticsearch/ccplugin.py @@ -52,6 +52,10 @@ {'type': 'string', 'default': '', 'help': 'all indexable types except given etypes' '[default: []]'}), + ('chunksize', + {'type': 'int', 'default': 100000, + 'help': 'max number of entities to fetch at once (deafult: 100000)', + }), ] def run(self, args): @@ -94,7 +98,9 @@ if index_name is None: index_name = cnx.vreg.config['index-name'] for etype in etypes: - for idx, entity in enumerate(indexable_entities(cnx, etype), 1): + for idx, entity in enumerate( + indexable_entities( + cnx, etype, chunksize=self.config.chunksize), 1): try: serializer = entity.cw_adapt_to('IFullTextIndexSerializable') json = serializer.serialize(complete=False)