Bug 39636

Summary: Add options to compare_es_to_db script
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Searching - ElasticsearchAssignee: Nick Clemens (kidclamp) <nick>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: tomascohen
Version: MainKeywords: rel_24_05_candidate, rel_24_11_candidate
Hardware: All   
OS: All   
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
Bug 39636: Add option to specify which indexes to check
Bug 39636: Update curl link
Bug 39636: Add option to specify which indexes to check
Bug 39636: Update curl link

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.