Bug 40890 - Make batch_size configurable for koha-es-indexer
Summary: Make batch_size configurable for koha-es-indexer
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-26 19:49 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-09-29 14:18 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
A new configuration entry has been introduced in `koha-conf.xml` to control how many Elasticsearch update tasks the indexer processes per iteration. Previously, the indexer defaulted to a batch size of 10. While the `koha-es-indexer` command supported overriding this with the `--batch_size` parameter, there was no way to set a different default value. This change is particularly beneficial for large sites, where the indexer may otherwise struggle to keep pace with the update queue during peak activity.
Version(s) released in:
Circulation function:


Attachments
Bug 40890: Make batch_size configurable for koha-es-indexer (3.91 KB, patch)
2025-09-26 20:07 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2025-09-26 19:49:53 UTC
The script allows setting a custom batch_size e.g. `koha-es-indexer --batch_size 100 --restart library` but it cannot be set permanently. So a reboot or a naive restart will set it back to 10.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-09-26 20:07:05 UTC
Created attachment 187014 [details] [review]
Bug 40890: Make batch_size configurable for koha-es-indexer

This patch adds a new configuration entry in `koha-conf.xml` for making
it possible to set a different `batch_size` for `koha-es-indexer`.

The current implementation has a default of *10* that can be overridden
using the CLI parameter `--batch_size N`.

Unfortunately, if you restart the server or the service without passing
the parameter, it will be set back to 10. This patch solves that by
adding a new config entry and making the script use it. The passed CLI
parameter will keep overridding the configured value.

To test:
1. Run:
   $ ktd --shell
  k$ koha-es-indexer --restart --batch_size 100 kohadev
  k$ ps -ef | grep elastic
=> SUCCESS: No errors. Notice '100' is passed to the called perl script
2. Run:
  k$ koha-es-indexer --restart kohadev
  k$ ps -ef | grep elastic
=> FAIL: Notice '10' is the new value
3. Apply this patch
4. Run:
  k$ reset_all
5. Repeat 1 and 2
=> SUCCESS: '100' is kept.
6. Try standalone `--start` too
7. Sign off :-D