---
title: Configuring a Custom Product Indexing Batch Size
slug: klevu-magento-v4/configuring-a-custom-product-indexing-batch-size
docTags: 
createdAt: 2026-06-08T07:32:29.988Z
---

## Configuring a Custom Product Indexing Batch Size

The product indexing module defines a batched entity provider using Magento dependency injection in `etc/di.xml`.

By default, the batch size is configured on the following virtual type:

- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched`

This virtual type sets the constructor argument:

- `batchSize`

and the module assigns it the default value:

- `Klevu\Indexing\Constants::DEFAULT_INDEXING_BATCH_SIZE`

### How to override the batch size

To use a custom batch size, add a DI override in your custom module’s `etc/di.xml` and set a numeric value for the `batchSize` argument.

Example:

```xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched">
        <arguments>
            <argument name="batchSize" xsi:type="number">500</argument>
        </arguments>
    </type>

</config>
```

### Why this works

The module declares a shared batched provider:

- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched`

Other batched product provider variants inherit from it, including:

- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Simple`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Virtual`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Downloadable`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Bundle`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Grouped`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\Configurable`
- `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched\ConfigurableVariants`

Overriding the shared `Batched` type updates the batch size used by all of these, unless a more specific subtype override is also declared.

### Example use case

If you want to increase the number of products processed in each batch during discovery, set a larger value such as:

```xml
<argument name="batchSize" xsi:type="number">500</argument>
```

If you want smaller, more conservative processing batches, use a lower value.

### Notes

- The value must be numeric.
- This change should be added in a custom module, not by editing the vendor module directly.
- After updating DI configuration, run the appropriate Magento cache/compiled dependency refresh steps for your environment.

### Summary

To pass a custom `batchSize`, override this DI argument in your custom module:

- Type: `Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched`
- Argument: `batchSize`

Example:

```xml
<type name="Klevu\IndexingProducts\Service\Provider\ProductEntityProvider\Batched">
    <arguments>
        <argument name="batchSize" xsi:type="number">500</argument>
    </arguments>
</type>
```

