Bugzilla – Attachment 190531 Details for
Bug 38345
Restore support for OpenSearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38345: Restore support for OpenSearch
4caf848.patch (text/plain), 2.88 KB, created by
Jonathan Druart
on 2025-12-16 08:51:18 UTC
(
hide
)
Description:
Bug 38345: Restore support for OpenSearch
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-12-16 08:51:18 UTC
Size:
2.88 KB
patch
obsolete
>From 4caf848c3012b62e014857a976c54feab1c421dc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 15 Dec 2025 15:25:07 +0100 >Subject: [PATCH] Bug 38345: Restore support for OpenSearch > >The Koha_Main_OS1 and Koha_Main_OS2 jobs are currently failing on >Jenkins. > >``` >[NoNodes] ** No nodes are available: [http://es:9200], called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Indexer.pm line 417. # Looks like your test exited with 11 just after 3. >``` > >We need to workaround Elasticsearch/OpenSearch product check >incompatibility. > >This patch suggests to monkey-patch >Search::Elasticsearch::Role::Cxn::process_response to disable the strict >product header check at runtime. This allows the same codebase to talk >to both Elasticsearch 8+ and OpenSearch without forking or patching >upstream. > >Test plan: >0. Set KOHA_ELASTICSEARCH=yes in ktd's .env >1. Startup ktd with the compose file for OS1 > ktd -f docker-compose.os1.yml up >2. Set SearchEngine=Elasticsearch >3. reindex > ktd --shell > perl misc/search_tools/rebuild_elasticsearch.pl -a -b >4. run the tests > prove -r t/db_dependent/Koha/SearchEngine/Elasticsearch >5. search! >http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=perl >should show results > >6. ktd down then repeat using the compose file for OS2 (docker-compose.os2.yml), ES6 and ES7 >for ES6 and ES7 you can use the --es6 and --es7 ktd flag. > >IF you get a 403 during the reindex you can try to add > cluster.routing.allocation.disk.threshold_enabled: "false" >to the environment section of the compose file. >Or >``` >curl -X PUT http://es:9200/_cluster/settings \ > -H 'Content-Type: application/json' \ > -d '{ > "persistent": { > "cluster.blocks.create_index": false > } > }' >``` >OS thinks we lack disk space and force all indices into read-only. >--- > Koha/SearchEngine/Elasticsearch.pm | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 53afa2929d0..67567c2b62b 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -38,6 +38,24 @@ use Clone qw( clone ); > use Modern::Perl; > use Readonly qw( Readonly ); > use Search::Elasticsearch; >+use Search::Elasticsearch::Role::Cxn; >+{ >+ # Monkey-patch Search::Elasticsearch::Role::Cxn::process_response >+ no warnings 'redefine'; >+ >+ my $orig_sub = \&Search::Elasticsearch::Role::Cxn::process_response; >+ >+ # Override method >+ *Search::Elasticsearch::Role::Cxn::process_response = sub { >+ my ( $self, $params, $code, $msg, $body, $headers ) = @_; >+ >+ if ( $headers && $headers->{'x-elastic-product'} ne 'Elasticsearch' ) { >+ $Search::Elasticsearch::Role::Cxn::PRODUCT_CHECK_VALUE = ''; >+ } >+ $orig_sub->(@_); >+ }; >+} >+ > use Try::Tiny qw( catch try ); > use YAML::XS; > >-- >2.43.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38345
:
190500
|
190531
|
190534
|
190556
|
190557
|
190580
|
190581