| 1 | package Elastic::Model::TypeMap::ES; | ||
| 2 | 23 | $Elastic::Model::TypeMap::ES::VERSION = '0.52'; | |
| 3 | 23 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 23 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 23 | ▶ | use Elastic::Model::TypeMap::Base qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 23 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | #=================================== | ||
| 10 | has_type 'Elastic::Model::Types::UID', | ||
| 11 | #=================================== | ||
| 12 | 0 | ▶ | deflate_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 13 | 0 | 'do {' | |
| 14 | . 'die "Cannot deflate UID as it not saved\n"' | ||
| 15 | . 'unless $val->from_store;' | ||
| 16 | . '$val->read_params;' . '}'; | ||
| 17 | }, | ||
| 18 | |||
| 19 | 0 | ▶ | inflate_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 20 | 0 | 'Elastic::Model::UID->new( from_store => 1, %$val )'; | |
| 21 | }, | ||
| 22 | |||
| 23 | 0 | ▶ | map_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 24 | 0 | my %props = map { $_ => { type => 'string', index => 'not_analyzed', } } | |
| 25 | qw(index type id routing); | ||
| 26 | |||
| 27 | 0 | $props{routing}{index} = 'no'; | |
| 28 | 0 | delete $props{routing}{index_name}; | |
| 29 | |||
| 30 | return ( | ||
| 31 | 0 | type => 'object', | |
| 32 | dynamic => 'strict', | ||
| 33 | properties => \%props, | ||
| 34 | path => 'full' | ||
| 35 | ); | ||
| 36 | |||
| 37 | 23 | }; | |
| 38 | |||
| 39 | #=================================== | ||
| 40 | has_type 'Elastic::Model::Types::Keyword', | ||
| 41 | #=================================== | ||
| 42 | 0 | ▶ | map_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 43 | 0 | type => 'string', | |
| 44 | index => 'not_analyzed' | ||
| 45 | 23 | }; | |
| 46 | |||
| 47 | #=================================== | ||
| 48 | has_type 'Elastic::Model::Types::GeoPoint', | ||
| 49 | #=================================== | ||
| 50 | 0 | ▶ | deflate_via {'$val'}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 51 | 0 | ▶ | inflate_via {'$val'}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 52 | 0 | ▶ | map_via { type => 'geo_point' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 53 | |||
| 54 | #=================================== | ||
| 55 | has_type 'Elastic::Model::Types::Binary', | ||
| 56 | #=================================== | ||
| 57 | 0 | ▶ | deflate_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 58 | 0 | require MIME::Base64; | |
| 59 | 0 | 'MIME::Base64::encode_base64( $val )'; | |
| 60 | }, | ||
| 61 | |||
| 62 | 0 | ▶ | inflate_via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 63 | 0 | 'MIME::Base64::decode_base64( $val )'; | |
| 64 | }, | ||
| 65 | |||
| 66 | 0 | ▶ | map_via { type => 'binary' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 67 | |||
| 68 | #=================================== | ||
| 69 | has_type 'Elastic::Model::Types::Timestamp', | ||
| 70 | #=================================== | ||
| 71 | 0 | ▶ | deflate_via {'int( $val * 1000 + 0.5 )'}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 72 | 0 | ▶ | inflate_via {'sprintf "%.3f", $val / 1000'}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 73 | 0 | ▶ | map_via { type => 'date' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 74 | |||
| 75 | 23 | 1; | |
| 76 | |||
| 77 | # ABSTRACT: Type maps for ElasticSearch-specific types | ||
| 78 | |||
| 79 | __END__ | ||