File Coverage

blib/lib/Elastic/Model/TypeMap/Default.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Elastic::Model::TypeMap::Default;
2             $Elastic::Model::TypeMap::Default::VERSION = '0.51';
3 23     23   17039 use strict;
  23         48  
  23         1035  
4 23     23   121 use warnings;
  23         42  
  23         982  
5              
6 23         163 use Elastic::Model::TypeMap::Base qw(
7             Elastic::Model::TypeMap::Moose
8             Elastic::Model::TypeMap::Structured
9             Elastic::Model::TypeMap::Common
10             Elastic::Model::TypeMap::Objects
11             Elastic::Model::TypeMap::ES
12 23     23   5792 );
  23         56  
13              
14             1;
15              
16             =pod
17            
18             =encoding UTF-8
19            
20             =head1 NAME
21            
22             Elastic::Model::TypeMap::Default - The default type map used by Elastic::Model
23            
24             =head1 VERSION
25            
26             version 0.51
27            
28             =head1 DESCRIPTION
29            
30             Moose's L<type constraints|Moose::Util::TypeConstraints> and introspection
31             allows Elastic::Model to figure out how to map your data model to the
32             Elasticsearch backend with the minimum of effort on your part.
33            
34             What YOU need to do is: B<Be specific about the type constraint for each attribute.>
35            
36             For instance, if you have an attribute called C<count>, then specify the
37             type constraint C<< isa => 'Int' >>.
38             That way, we know how to define the field in Elasticsearch, and how to deflate
39             and inflate the value.
40            
41             Type constraints can inherit their mapping, inflator and deflator from
42             their parent type-constraints. For instance, if you were to assign
43             C<count> the type constraint C<PositiveInt>, although we don't know about that
44             constraint, we do know about its parent, C<Int>, so we could
45             still handle the field correctly.
46            
47             Type maps are used to define:
48            
49             =over
50            
51             =item *
52            
53             what mapping Elastic::Model will generate for each attribute when you
54             L<create an index|Elastic::Model::Domain::Admin/"create_index()">
55             or L<update the mapping|Elastic::Model::Domain::Admin/"update_mapping()"> of an
56             existing index.
57            
58             =item *
59            
60             how Elastic::Model will deflate and inflate each attribute when saving or
61             retrieving docs stored in Elasticsearch.
62            
63             =back
64            
65             =head1 BUILT-IN TYPE MAPS
66            
67             L<Elastic::Model::TypeMap::Default> loads the following type-maps.
68            
69             =over
70            
71             =item *
72            
73             L<Elastic::Model::TypeMap::Moose>
74            
75             =item *
76            
77             L<Elastic::Model::TypeMap::Objects>
78            
79             =item *
80            
81             L<Elastic::Model::TypeMap::Structured>
82            
83             =item *
84            
85             L<Elastic::Model::TypeMap::ES>
86            
87             =item *
88            
89             L<Elastic::Model::TypeMap::Common>
90            
91             =back
92            
93             =head1 DEFINING YOUR OWN TYPE MAP
94            
95             See L<Elastic::Model::TypeMap::Base> for instructions on how to define
96             your own type-map classes.
97            
98             =head1 TWEAKING YOUR ATTRIBUTE MAPPING
99            
100             See L<Elastic::Manual::Attributes> for keywords you can use in your
101             attribute declarations to tweak the mapping of individual fields.
102            
103             =head1 AUTHOR
104            
105             Clinton Gormley <drtech@cpan.org>
106            
107             =head1 COPYRIGHT AND LICENSE
108            
109             This software is copyright (c) 2015 by Clinton Gormley.
110            
111             This is free software; you can redistribute it and/or modify it under
112             the same terms as the Perl 5 programming language system itself.
113            
114             =cut
115              
116             __END__
117            
118             # ABSTRACT: The default type map used by Elastic::Model
119            
120