Bug 36550 - koha-elasticsearch commit default should be configurable
Summary: koha-elasticsearch commit default should be configurable
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Robin Sheat
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-09 02:26 UTC by David Cook
Modified: 2025-11-28 10:41 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 36550: allow defaults to be defined for koha-elasticsearch (3.72 KB, patch)
2025-11-21 01:59 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 36550: allow defaults to be defined for koha-elasticsearch (3.78 KB, patch)
2025-11-21 02:22 UTC, David Cook
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2024-04-09 02:26:35 UTC
It can be easy to forget the --commit option when running koha-elasticsearch especially across teams. 

It would be good if we could specify a different default value (rather than 5000) say in /etc/default/koha-common for instance. 

On a system with memory restrictions, 5000 is way too high, and will lead to incomplete ES indexing, which is quite bothersome to rectify after the fact.
Comment 1 Robin Sheat 2025-11-21 01:59:47 UTC
Created attachment 189821 [details] [review]
Bug 36550: allow defaults to be defined for koha-elasticsearch

koha-elasticsearch only allows the parameters to be specified on the
command line, otherwise it'll fall back to values hard-coded in the
script. This allows default parameters to be defined in
/etc/default/koha-common when installed with the Debian packages.

It also copies the current defaults into the defaults file.

Test plan, comprehensive:
1. You will need a package setup with elasticsearch, and some records.
2. Build a package (or copy the files modified in this patch over ones
   you might already have installed)
3. Modify some ES_* values in /etc/default/koha-community to your
   liking.  'ES_VERBOSE' might be a good one.
4. Do an elasticsearch reindex and observe that your parameter defaults
   are respected.

Test plan, simple:
1. With a git checkout:
   * `sudo ln -s .../koha/debian/scripts/koha-functions.sh /usr/share/koha/bin/koha-functions.sh`
   * `sudo ln -s .../koha/debian/koha-common.default /etc/default/koha-common`
2. Modify `.../koha/debian/scripts/koha-elasticsearch` around line 200
   so that it prints out the variables, and see that it properly respects
   modifying the defaults and/or setting the command line arguments.
Comment 2 David Cook 2025-11-21 02:22:04 UTC
Created attachment 189822 [details] [review]
Bug 36550: allow defaults to be defined for koha-elasticsearch

koha-elasticsearch only allows the parameters to be specified on the
command line, otherwise it'll fall back to values hard-coded in the
script. This allows default parameters to be defined in
/etc/default/koha-common when installed with the Debian packages.

It also copies the current defaults into the defaults file.

Test plan, comprehensive:
1. You will need a package setup with elasticsearch, and some records.
2. Build a package (or copy the files modified in this patch over ones
   you might already have installed)
3. Modify some ES_* values in /etc/default/koha-community to your
   liking.  'ES_VERBOSE' might be a good one.
4. Do an elasticsearch reindex and observe that your parameter defaults
   are respected.

Test plan, simple:
1. With a git checkout:
   * `sudo ln -s .../koha/debian/scripts/koha-functions.sh /usr/share/koha/bin/koha-functions.sh`
   * `sudo ln -s .../koha/debian/koha-common.default /etc/default/koha-common`
2. Modify `.../koha/debian/scripts/koha-elasticsearch` around line 200
   so that it prints out the variables, and see that it properly respects
   modifying the defaults and/or setting the command line arguments.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 3 Marcel de Rooy 2025-11-28 10:41:44 UTC
Shouldnt this be marked as enh ?