icsearch::Serializer::JSON;
$Search::Elasticsearch::Serializer::JSON::VERSION = '8.12';
use Moo;
use JSON::MaybeXS 1.002002 ();
has 'JSON' => ( is => 'ro', default => sub { JSON::MaybeXS->new->utf8(1
:JSON';
use namespace::clean;
1;
# ABSTRACT: The default JSON Serializer, using JSON::MaybeXS
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON - The default JSON
Serializer, using JSON::MaybeXS
=head1 VERSION
version 8.12
=head1 SYNOPSIS
$e = Search::Elasticsearch(
# serializer => 'JSON'
);
=head1 DESCRIPTION
This default Serializer clas
Elasticsearch::Serializer::JSON::PP;
$Search::Elasticsearch::Serializer::JSON::PP::VERSION = '8.12';
use Moo;
use JSON::PP;
has 'JSON' => ( is => 'ro', default => sub { JSON::PP->new->utf8(1) } );
w
Serializer::JSON';
1;
# ABSTRACT: A JSON Serializer using JSON::PP
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::PP - A JSON Serializer using JSON::PP
=head
h(
serializer => 'JSON::PP'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module allo
:Serializer::JSON::Cpanel;
$Search::Elasticsearch::Serializer::JSON::Cpanel::VERSION = '8.12';
use Cpanel::JSON::XS;
use Moo;
has 'JSON' =>
( is => 'ro', default => sub { Cpanel::JSON::XS->new->u
Elasticsearch::Role::Serializer::JSON';
1;
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::Cpanel - A JSON Serializer using Cpanel::JSON::XS
=head1 VERSION
version 8.1
serializer => 'JSON::Cpanel'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module al
package Search::Elasticsearch::Role::Serializer::JSON;
$Search::Elasticsearch::Role::Serializer::JSON::VERSION = '8.12';
use Moo::Role;
requires 'JSON';
use Search::Elasticsearch::Util qw(throw);
us
de_utf8 is_utf8);
use namespace::clean;
has 'mime_type' => ( is => 'ro', default => 'application/json' );
with 'Search::Elasticsearch::Role::Serializer';
#===================================
sub en
n is_utf8($var)
? encode_utf8($var)
: $var;
}
return try { $self->JSON->encode($var) }
catch { throw( "Serializer", $_, { var => $var } ) };
}
#===================
sticsearch::Serializer::JSON::XS;
$Search::Elasticsearch::Serializer::JSON::XS::VERSION = '8.12';
use Moo;
use JSON::XS 2.26;
has 'JSON' => ( is => 'ro', default => sub { JSON::XS->new->utf8(1) } );
arch::Elasticsearch::Role::Serializer::JSON';
1;
=pod
=encoding UTF-8
=head1 NAME
Search::Elasticsearch::Serializer::JSON::XS - A JSON Serializer using JSON::XS
=head1 VERSION
version 8.12
=he
h(
serializer => 'JSON::XS'
);
=head1 DESCRIPTION
While the default serializer, L<Search::Elasticsearch::Serializer::JSON>,
tries to choose the appropriate JSON backend, this module allo
3 ];
}
return $o .= ( '-' x 80 ) . "\n";
}
#===================================
sub TO_JSON {
#===================================
my $self = shift;
return $self->_stringify;
}
1;
xt (for example: C<print 'Oh no! '.$error>). They also support the C<TO_JSON>
method to support conversion to JSON when L<JSON/convert_blessed> is enabled.
=head1 ERROR CLASSES
The following error
e method is changed to C<POST> when a body is present.
=item * C<source>
The body is encoded as JSON and added to the query string as the C<source>
parameter. This has the advantage of still being
);
=item C<serialize>
Whether the C<body> should be serialized in the standard way (as plain
JSON) or using the special I<bulk> format: C<"std"> or C<"bulk">.
=back
=head1 AUTHOR
Enrico Zimue
icsearch::Logger', 'LogAny' ],
serializer => [ 'Search::Elasticsearch::Serializer', 'JSON' ],
transport => [ 'Search::Elasticsearch::Transport', '' ],
);
my @Load_Order = qw(
ializer::JSON> (default)
=item * L<Search::Elasticsearch::Serializer::JSON::Cpanel>
=item * L<Search::Elasticsearch::Serializer::JSON::XS>
=item * L<Search::Elasticsearch::Serializer::JSON::PP>
=b
,
# optional
data => $body_as_string,
mime_type => 'application/json',
timeout => $timeout
});
Sends the request to the associated Elasticsearch node
,
# optional
data => $body_as_string,
mime_type => 'application/json',
timeout => $timeout
});
Sends the request to the associated Elasticsearch node
,
# optional
data => $body_as_string,
mime_type => 'application/json',
timeout => $timeout
});
Sends the request to the associated Elasticsearch node
pt only a JSON C<true> or C<false>, or the string equivalents C<"true"> or C<"false">.
In the Perl client, you can use the following values:
=over
=item * True: C<true>, C<\1>, or a L<JSON::PP::Boo
lse>, C<\0>, or a L<JSON::PP::Boolean> object.
=back
=head2 Filter path parameter
Any API which returns a JSON body accepts a C<filter_path> parameter
which will filter the JSON down to only the sp
ional
);
Renders the template, filling in the passed-in parameters and returns the resulting JSON, eg:
$results = $e->render_search_template(
body => {
source => {
@_) {
my @json = $self->_encode_action( splice( @_, 0, 2 ) );
push @$buffer, @json;
my $size = $self->_buffer_size;
$size += length($_) + 1 for @json;
$self->
s a queue, buffering up actions
until it reaches a maximum count of actions, or a maximum size of JSON request
body, at which point it issues a C<bulk()> request.
Once you have finished adding action
by setting C<max_count> to C<0>. Defaults to
C<1,000>.
=item * C<max_size>
The maximum size of JSON request body to allow before triggering a
L</flush()>. This can be disabled by setting C<max_siz
@_) {
my @json = $self->_encode_action( splice( @_, 0, 2 ) );
push @$buffer, @json;
my $size = $self->_buffer_size;
$size += length($_) + 1 for @json;
$self->
s a queue, buffering up actions
until it reaches a maximum count of actions, or a maximum size of JSON request
body, at which point it issues a C<bulk()> request.
Once you have finished adding action
by setting C<max_count> to C<0>. Defaults to
C<1,000>.
=item * C<max_size>
The maximum size of JSON request body to allow before triggering a
L</flush()>. This can be disabled by setting C<max_siz
pt only a JSON C<true> or C<false>, or the string equivalents C<"true"> or C<"false">.
In the Perl client, you can use the following values:
=over
=item * True: C<true>, C<\1>, or a L<JSON::PP::Boo
lse>, C<\0>, or a L<JSON::PP::Boolean> object.
=back
=head2 Filter path parameter
Any API which returns a JSON body accepts a C<filter_path> parameter
which will filter the JSON down to only the sp
ional
);
Renders the template, filling in the passed-in parameters and returns the resulting JSON, eg:
$results = $e->render_search_template(
body => {
inline => {
>
=item *
C<decode()>
=item *
C<mime_type()>
=back
See L<Search::Elasticsearch::Serializer::JSON> for more.
=head1 AUTHOR
Enrico Zimuel <enrico.zimuel@elastic.co>
=head1 COPYRIGHT AND LICENSE
se' if $$val eq 0;
return 'true' if $$val eq 1;
}
elsif ( UNIVERSAL::isa( $val, "JSON::PP::Boolean" ) ) {
return "$val" ? 'true' : 'false';
}
return "$val";
}
#======
ticsearch::Role::Serializer>-based object,
which defaults to L<Search::Elasticsearch::Serializer::JSON>.
=head2 C<current_cxn_num()>
$num = $cxn_pool->current_cxn_num
Returns the current cxn nu
ers{'Accept'} = 'application/vnd.elasticsearch+json;compatible-with=7';
$default_headers{'Content-Type'} = 'application/vnd.elasticsearch+json; compatible-with=7';
}
if (defined $
{type};
$msg .= $error->{reason} if $error->{reason};
return $msg;
}
my $json = $self->serializer;
my @msgs;
for (@$root_causes) {
my %cause = (%$_);
m
"] " . ( delete $cause{reason} );
if ( keys %cause ) {
$msg .= ", with: " . $json->encode( \%cause );
}
push @msgs, $msg;
}
return ( join ", ", @msgs );
}
;
The C<post()> method adds or updates the license for the cluster. The C<body>
can be passed as JSON or as a string.
See the L<license.put docs|https://www.elastic.co/guide/en/x-pack/current/instal