3 # Koha library project www.koha-community.org
5 # Copyright 2020 Koha Development Team
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
25 # standard or CPAN modules used
26 use CGI qw(:standard -utf8);
34 use C4::Output qw( output_html_with_http_headers );
35 use C4::Auth qw(get_template_and_user);
39 use Koha::SearchEngine::Elasticsearch;
40 use LWP::Simple qw/get/;
43 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
45 template_name => "catalogue/showelastic.tt",
48 flagsrequired => { catalogue => 1 },
53 my $biblionumber = $input->param('id');
55 my $es = Koha::SearchEngine::Elasticsearch->new({index=>'biblios'});
61 $es_record = $es->get_elasticsearch()->get({
62 index => $es->index_name,
69 print $input->redirect("/cgi-bin/koha/errors/404.pl");
72 for my $field (sort keys %{$es_record} ){
73 push @es_fields, { $field, $es_record->{$field} };
75 $template->param( esrecord => to_json( \@es_fields ) );
76 output_html_with_http_headers $input, $cookie, $template->output;