Bug 21675 - Unable to add to a basket with ElasticSearch enabled
Summary: Unable to add to a basket with ElasticSearch enabled
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact:
Depends on:
Reported: 2018-10-25 21:31 UTC by Aleisha Amohia
Modified: 2020-01-06 20:14 UTC (History)
5 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2018-10-25 21:31:40 UTC
Found when testing Bug 16939.

To reproduce:
Set SearchEngine syspref to Elasticsearch
Go to Acquisitions and find a basket 
Add an order to the basket from an existing record
Confirm error

Message in error logs:
neworderbiblio.pl: [NoNodes] ** No nodes are available: [http://localhost:9200], called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /usr/share/perl5/Catmandu/Store/ElasticSearch.pm line 27. at /home/vagrant/kohaclone/Koha/SearchEngine/Elasticsearch.pm line 437., referer: http://localhost:8081/cgi-bin/koha/acqui/booksellers.pl
neworderbiblio.pl: Unable to perform your search. Please try again., referer: http://localhost:8081/cgi-bin/koha/acqui/booksellers.pl
Comment 1 Nick Clemens 2018-11-21 13:14:39 UTC
The "No nodes are available" message suggests an issue with your ES server, can you confirm ES is running and searchign si working and then see if this can be recreated?

I can add to baskets with no issues.
Comment 2 Reza 2018-11-29 07:06:15 UTC
I am facing the same issue. After upgrading to the latest:

$ koha-elasticsearch --verbose --rebuild $instance

Indexing biblios
[NoNodes] ** No nodes are available: [vpc-els-w2lu.ap-southeast-1.es.amazonaws.com], called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /usr/share/koha/lib/Koha/SearchEngine/Elasticsearch/Indexer.pm line 382.

ES is up and running with 2 nodes.

Curl response from Koha server:

  "name" : "PiJKGkk",
  "cluster_name" : "18949800000:els",
  "cluster_uuid" : "KJB8jbkjhjki78KJKJ88",
  "version" : {
    "number" : "5.5.2",
    "build_hash" : "b2f0c09",
    "build_date" : "2018-09-11T13:05:43.663Z",
    "build_snapshot" : true,
    "lucene_version" : "6.6.0"
  "tagline" : "You Know, for Search"
Comment 3 Reza 2018-11-29 07:13:03 UTC
Koha Version
Comment 4 Jonathan Druart 2018-12-06 13:42:38 UTC
Same here, search is working ok, so it's not a configuration issue.

I'd say the problem is that we are passing the result of build_query_compat to simple_search_compat. Regarding other calls it expects a string.
It also appears from addbooks.pl

The POD says both are ok:
 A thing to search for. It could be a simple string, or something constructed
 with the appropriate QueryBuilder module.

Hard to say what is expected as this method is not covered by tests (!)

Upping severity.
Comment 5 Jonathan Druart 2018-12-06 13:43:50 UTC
(In reply to Reza from comment #2)
> I am facing the same issue.

I do not think it is the same issue, it looks like a configuration problem.
Comment 6 Jonathan Druart 2018-12-06 13:55:05 UTC
Scratch the last comment, I get the same error with a "normal search"
Comment 7 Jonathan Druart 2018-12-06 14:33:08 UTC
(for the record)

Works for me finally, I had to upgrade elastic and:

% cd /usr/share/elasticsearch
% sudo bin/elasticsearch-plugin remove analysis-icu
% sudo bin/elasticsearch-plugin install analysis-icu

hit /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1

% perl misc/search_tools/rebuild_elastic_search.pl -d
% sudo koha-elasticsearch --rebuild -b -a kohadev

not trivial...
Comment 8 Reza 2018-12-07 01:58:34 UTC
I contacted Catalyst to solve the issue for us. 

Our Koha is installed with a memcached and an elastic search cluster with two nodes.

This is the finding:

On line 92 of Koha::SearchEngine::Elasticsearch I
removed cxn_pool => 'Sniff',

This allowed us to connect to the Amazon Elastic cluster.
I then dropped and recreated the Elasticsearch indexes

I note that it errored if you tried to do the default 5000 records per
commit, and that it still didn't like 1000, but it was happy at 100

So when you run

koha-elasticsearch --rebuild apiit   you want to also add -c 100 so it
does 100 records at a time.
Comment 9 Jonathan Druart 2018-12-07 13:17:53 UTC
Reza, I have opened bug 21974 to deal with cxn_pool. I think the original error reported here was a configuration problem as Aleisha was testing it locally.