-free and document oriented
Elasticsearch stores your objects as JSON documents. Most Perl objects
can be mapped easily to their JSON equivalent.
It is schema free, in that you don't need to define
your
field/properties/attributes ahead of time; you can just toss it a JSON
document and it'll try to autodetect data types and index your doc. That
said, the power of full text search comes from the
d_cache_key {
#===================================
my $self = shift;
return $self->model->json->encode( $self->search );
}
#===================================
sub BUILD {
#==================
cpan.org/module/CHI#Getting-and-setting>
methods.
=head2 cache_key
The cache_key is a canonical JSON string representation of the full
L<Elastic::Model::Role::Results/search> parameter.
=head1 AUTH
arch/reference/current/query-dsl.html> which
exposes much of the power of Lucene through a simple JSON interface.
It is tuned for full text search, but is in no way limited just
to that. It also provi
"Document" is like a "row" in a relational DB table. Elastic::Model
converts your objects into a JSON object (essentially a hashref), which
is the Document that is stored in Elasticsearch. We use th
n an L</Index>,
has a single L</Type>, an L</ID> and zero or more L<Fields|/Field>.
The original JSON object is stored in the special C<_source> field, which
is returned by default when you retrieve
$self);
my %original = %{ $self->uid->from_store ? $self->_source : {} };
my $json = $self->model->json;
my %old;
my ( $o, $c, $o_str, $c_str );
my $meta = Class::MOP::class_
ete $original{$key}, $current->{$key} );
( $o_str, $c_str )
= map { ref $_ ? $json->encode($_) : $_ } ( $o, $c );
if ( $o_str ne $c_str ) {
$old{$key} = $meta-
deflation or inflation is attempted - the value is passed unaltered. If it
is not a value that L<JSON::XS> can handle (eg a blessed value) then
deflation will fail.
It is mapped as: C<< { type => 'o
pe => 'boolean',
null_value => 0
}
=head2 Maybe
An undef value is stored as a JSON C<null>. The mapping and in/deflation depend
on the content type, eg C<Maybe[Int]>. A C<Maybe> w
leted();
use Scalar::Util qw(blessed refaddr weaken);
use List::MoreUtils qw(uniq);
use JSON();
our $JSON = JSON->new->canonical->utf8;
use namespace::autoclean;
my @wrapped_classes = qw(
domain
;
delete $mapping{type};
return \%mapping;
}
#===================================
sub json {$JSON}
#===================================
1;
=pod
=encoding UTF-8
=head1 NAME
Elastic::Model
late
an object which does L<Elastic::Model::Role::Doc> into a hash ref
suitable for conversion to JSON.
=head3 deflators
$deflators = $model->deflators
A hashref which caches all of the deflato
e to inflate or deflate the
value - it is just passed through unchanged. If it is a value that
L<JSON::XS> cannot handle natively, (eg a blessed ref), then Elastic::Model
will be unable to deal with
ef> to be an acceptable C<false>
value. However, an C<undef> in Perl is converted to a C<null> in JSON, which
Elasticsearch would understand as meaning "this field has no value" or
"is missing".
For t
h have been serialised to hashrefs) are considered
to be "objects", as in JSON objects. Your doc class is serialized to a
JSON object/hash, which is known as the L<root_object|http://www.elasticsearch