Summary: | catalogue/showelastic.pl uses deprecated/removed parameter "type" | ||
---|---|---|---|
Product: | Koha | Reporter: | Michał <schodkowy.omegi-0r> |
Component: | Searching - Elasticsearch | Assignee: | Michał <schodkowy.omegi-0r> |
Status: | RESOLVED FIXED | QA Contact: | Julian Maurice <julian.maurice> |
Severity: | minor | ||
Priority: | P5 - low | CC: | aleisha, david, fridolin.somers, julian.maurice, lucas, nick, schodkowy.omegi-0r |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38912 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes the display when clicking on "Show" for the "Elasticsearch record" entry for a record in the staff interface. Before this fix, a page not found (404) was displayed when viewing a record using Elasticsearch 7 or 8, or Open Search 1 ord 2. (Note that Elasticsearch 6 is no longer supported.)
|
Version(s) released in: |
24.05.00,23.11.02
|
Circulation function: | |||
Bug Depends on: | 18829, 33353 | ||
Bug Blocks: | 37494 | ||
Attachments: |
[PATCH] Bug 35618: Remove deprecated parameter "type" from showelastic.pl page
Bug 35618: Remove deprecated parameter "type" from showelastic.pl page Bug 35618: Remove deprecated parameter "type" from showelastic.pl page Bug 35618 - catalogue/showelastic.pl uses deprecated/removed parameter "type" [ES7.x] |
Description
Michał
2023-12-20 15:04:07 UTC
Created attachment 160123 [details] [review] [PATCH] Bug 35618: Remove deprecated parameter "type" from showelastic.pl page This fixes the issue with ES8, should still work with ES7 as there types were just deprecated (and not fully removed yet). Won't work with ES6, but Koha master doesn't support it anymore already. Should be backported to 23.11, but not to 23.05 or earlier. To test, one should view a biblio record in staff interface and press "Show" next to "Elasticsearch Record:". With ES8 it will return 404 before applying this patch, check log in /var/log/koha/biblioteka/plack-intranet-error.log Created attachment 160221 [details] [review] Bug 35618: Remove deprecated parameter "type" from showelastic.pl page This is a follow-up to Bug 33353. Types are gone in ES8 and deprecated in ES7. Support for ES6 is already dropped in Koha master. The parameter has to be removed, otherwise an exception is thrown with ES8 (which is listed as officially supported by Koha now). Signed-off-by: David Nind <david@davidnind.com> Testing notes (using koha-testing-docker (KTD)): 1. Start up KTD with Elasticsearch 8 (ktd --es8 up) 2. In the staff interface, search and view a record. 3. For "Elasticsearch Record", click on the "Show" link. ==> Pop up window says "An error has occured Error 404..." ==> In /var/log/koha/kohadev/plack-intranet-error.log there is a warning: ES8: [2023/12/21 20:40:33] [WARN] [Request] ** [http://es:9200]-[400] no handler found for uri [/koha_kohadev_biblios/data/46] and method [GET], called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /kohadevbox/koha/catalogue/showelastic.pl line 61. With vars: {'request' => {'body' => undef,'method' => 'GET','serialize' => 'std','path' => '/koha_kohadev_biblios/data/46','ignore' => [],'qs' => {}},'body' => {'error' => 'no handler found for uri [/koha_kohadev_biblios/data/46] and method [GET]'},'status_code' => 400} ES7: [2023/12/21 21:05:31] [WARN] [Missing] ** [http://es:9200]-[404] Not Found, called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /kohadevbox/koha/catalogue/showelastic.pl line 61. With vars: {'request' => {'ignore' => [],'qs' => {},'path' => '/koha_kohadev_biblios/data/32','method' => 'GET','serialize' => 'std','body' => undef},'status_code' => 404,'body' => {'_index' => 'koha_kohadev_biblios','_type' => 'data','found' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),'_id' => '32'}} OS1: [2023/12/21 21:15:14] [WARN] [Missing] ** [http://es:9200]-[404] Not Found, called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /kohadevbox/koha/catalogue/showelastic.pl line 61. With vars: {'request' => {'ignore' => [],'path' => '/koha_kohadev_biblios/data/32','method' => 'GET','qs' => {},'serialize' => 'std','body' => undef},'status_code' => 404,'body' => {'_type' => 'data','_id' => '32','found' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),'_index' => 'koha_kohadev_biblios'}} OS2: [2023/12/21 21:25:04] [WARN] [Request] ** [http://es:9200]-[400] no handler found for uri [/koha_kohadev_biblios/data/5] and method [GET], called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /kohadevbox/koha/catalogue/showelastic.pl line 61. With vars: {'body' => {'error' => 'no handler found for uri [/koha_kohadev_biblios/data/5] and method [GET]'},'status_code' => 400,'request' => {'body' => undef,'method' => 'GET','path' => '/koha_kohadev_biblios/data/5','qs' => {},'ignore' => [],'serialize' => 'std'}} 4. Apply the patch and restart_all. 5. Repeat steps 2-3: ==> The pop-up window should now show the Elasticsearch record and no warning in the log [1]. 6. Repeat using Elasticsearch 7 (ktd --es7 up), OpenSearch 1 (ktd --os1 up)and OpenSearch 2 (ktd --es7 up). [1] Note that there are two warnings in the log - these are generated when you view the record in the staff interface, so I'm assuming that these are unrelated to this bug: [2023/12/21 20:49:44] [WARN] DBIx::Class::ResultSetColumn::new(): Attempting to retrieve non-unique column 'biblionumber' on a resultset containing one-to-many joins will return duplicate results. at /kohadevbox/koha/Koha/Objects.pm line 426 [2023/12/21 20:49:44] [WARN] DBIx::Class::ResultSet::_construct_results(): Unable to properly collapse has_many results in iterator mode due to order criteria - performed an eager cursor slurp underneath. Consider using ->all() instead at /kohadevbox/koha/Koha/Objects.pm line 317 Yeah the other warnings are probably unrelated directly to this. Repeatedly opening the Elasticsearch record view only repeatedly generates the single warn about type param being invalid. Created attachment 160227 [details] [review] Bug 35618: Remove deprecated parameter "type" from showelastic.pl page This is a follow-up to Bug 33353. Types are gone in ES8 and deprecated in ES7. Support for ES6 is already dropped in Koha master. The parameter has to be removed, otherwise an exception is thrown with ES8 (which is listed as officially supported by Koha now). Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Pushed for 24.05! Well done everyone, thank you! Pushed to 23.11.x for 23.11.02 Missing 23.05.x dependencies. No backport. Created attachment 168306 [details] [review] Bug 35618 - catalogue/showelastic.pl uses deprecated/removed parameter "type" [ES7.x] it appears despite "type" being depreciated it's still required in some cases. [2024/07/01 14:24:52] [WARN] [Param] ** Missing required param (type) in (get) request. , called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /usr/share/koha/intranet/cgi-bin/catalogue/showelastic.pl line 61. subbing it out with type '_doc' seems to do the trick (In reply to Danyon Sewell from comment #9) > Created attachment 168306 [details] [review] [review] > Bug 35618 - catalogue/showelastic.pl uses deprecated/removed parameter > "type" [ES7.x] > > it appears despite "type" being depreciated it's still required in some > cases. > > [2024/07/01 14:24:52] [WARN] [Param] ** Missing required param (type) in > (get) request. , called from sub > Search::Elasticsearch::Role::Client::Direct::__ANON__ at > /usr/share/koha/intranet/cgi-bin/catalogue/showelastic.pl line 61. > > subbing it out with type '_doc' seems to do the trick As far as I can tell this only works if Koha has not been reindexed and the 'type' / 'data' is stil defined in the indexes - in both ES7 and ES8 it breaks when I add "_doc" If this is still an issue can you file anew bug Danyon? I've opened Bug 37494 to propose your fix Danyon. Please go and test it ;) Works for me with ES 8. This report is closed so I hide your patch. I love this super-cool ES feature. |