Bug 39636 - Add options to compare_es_to_db script
Summary: Add options to compare_es_to_db script
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords: rel_24_05_candidate, rel_24_11_candidate
Depends on:
Blocks:
 
Reported: 2025-04-15 11:47 UTC by Nick Clemens (kidclamp)
Modified: 2025-04-17 15:09 UTC (History)
1 user (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39636: Update curl link (1.30 KB, patch)
2025-04-15 12:02 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39636: Add option to specify which indexes to check (2.37 KB, patch)
2025-04-15 12:02 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39636: Update curl link (1.30 KB, patch)
2025-04-15 12:02 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39636: Add option to specify which indexes to check (2.50 KB, patch)
2025-04-15 14:32 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 39636: Update curl link (1.35 KB, patch)
2025-04-15 14:32 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 Nick Clemens (kidclamp) 2025-04-15 11:47:03 UTC
It would be nice to be able to only run the check against a single index

Additionally, getting links to the staff side can be useful when library staff need to edit/update bad records
Comment 1 Nick Clemens (kidclamp) 2025-04-15 11:56:37 UTC
(In reply to Nick Clemens (kidclamp) from comment #0)
> Additionally, getting links to the staff side can be useful when library
> staff need to edit/update bad records

Oops - this was already done
Comment 2 Nick Clemens (kidclamp) 2025-04-15 12:02:21 UTC
Created attachment 180957 [details] [review]
Bug 39636: Update curl link

With the move to the latest ES versions we got rid of 'data' type - we need to use '_doc'

To test:
1 - Delete a record from the DB directly
    DELETE FROM biblio WHERE biblionumber=45;
2 - perl misc/maintenance/compare_es_to_db.pl
3 - Try the curl command - it doesn't work
4 - Apply this patch
5 - perl misc/maintenance/compare_es_to_db.pl
6 - Try the curl command - it now fetches the record
Comment 3 Nick Clemens (kidclamp) 2025-04-15 12:02:52 UTC
Created attachment 180958 [details] [review]
Bug 39636: Add option to specify which indexes to check

This patch adds --biblios and --authorities options to the script to allow
checking only a single index

To test:
0 - Apply patch
1 - perl misc/maintenance/compare_es_to_db.pl
2 - biblios and authorities are checked
3 - perl misc/maintenance/compare_es_to_db.pl -b
4 - Only biblios are checked
5 - perl misc/maintenance/compare_es_to_db.pl -a
6 - Only authorities are checked
7 - perl misc/maintenance/compare_es_to_db.pl -a -b
8 - Both indexes are checked
Comment 4 Nick Clemens (kidclamp) 2025-04-15 12:02:54 UTC
Created attachment 180959 [details] [review]
Bug 39636: Update curl link

With the move to the latest ES versions we got rid of 'data' type - we need to use '_doc'

To test:
1 - Delete a record from the DB directly
    DELETE FROM biblio WHERE biblionumber=45;
2 - perl misc/maintenance/compare_es_to_db.pl
3 - Try the curl command - it doesn't work
4 - Apply this patch
5 - perl misc/maintenance/compare_es_to_db.pl
6 - Try the curl command - it now fetches the record
Comment 5 Tomás Cohen Arazi (tcohen) 2025-04-15 14:32:39 UTC
Created attachment 180972 [details] [review]
Bug 39636: Add option to specify which indexes to check

This patch adds --biblios and --authorities options to the script to allow
checking only a single index

To test:
0 - Apply patch
1 - perl misc/maintenance/compare_es_to_db.pl
2 - biblios and authorities are checked
3 - perl misc/maintenance/compare_es_to_db.pl -b
4 - Only biblios are checked
5 - perl misc/maintenance/compare_es_to_db.pl -a
6 - Only authorities are checked
7 - perl misc/maintenance/compare_es_to_db.pl -a -b
8 - Both indexes are checked

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidied
Comment 6 Tomás Cohen Arazi (tcohen) 2025-04-15 14:32:42 UTC
Created attachment 180973 [details] [review]
Bug 39636: Update curl link

With the move to the latest ES versions we got rid of 'data' type - we need to use '_doc'

To test:
1 - Delete a record from the DB directly
    DELETE FROM biblio WHERE biblionumber=45;
2 - perl misc/maintenance/compare_es_to_db.pl
3 - Try the curl command - it doesn't work
4 - Apply this patch
5 - perl misc/maintenance/compare_es_to_db.pl
6 - Try the curl command - it now fetches the record

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi (tcohen) 2025-04-15 14:33:51 UTC
Nice, thank you! QA script happy and works as expected.
Comment 8 Tomás Cohen Arazi (tcohen) 2025-04-17 15:09:10 UTC
Please backport this helpful maintenance enhancement.