Elastic::Model::TypeMap::Structured - Type maps for MooseX::Types::Structured
version 0.02
Elastic::Model::TypeMap::Structured provides mapping, inflation and deflation for the MooseX::Types::Structured type constraints. It is loaded automatically byElastic::Model::TypeMap::Default.
Optional values are mapped, inflated and deflated according to their content type, eg Optional[Int]. An Optional type with no content type is mapped as <{ type = 'object', enabled => 'no' }>> and the value would be passed through unaltered when deflating/inflating.
Optional[Int]
Optional
<{ type =
Because array refs are interpreted by ElasticSearch as multiple values of the same type, tuples are converted to hash refs whose keys are the index number. For instance, a field foo with Tuple[Int,Str] and value [5,'foo'] will be deflated to { 0 => 5, 1 => 'foo' }.
foo
Tuple[Int,Str]
[5,'foo']
{ 0 => 5, 1 => 'foo' }
A tuple is mapped as an object, with:
{ type => 'object', dynamic => 'strict', properties => \%properties }
The %properties mapping depends on the content types. A Tuple without content types is mapped as <{ type = 'object', enabled => 'no' }>> and the value would be passed through unaltered when deflating/inflating.
%properties
Tuple
A Dict is mapped as an object, with:
Dict
The %properties mapping depends on the content types. A Dict without content types is mapped as <{ type = 'object', enabled => 'no' }>> and the value would be passed through unaltered when deflating/inflating.
It is not advisable to allow arbitrary key names in indexed hashes, as you could end up generating many (and conflicting) field mappings. For this reason, Maps are mapped as { type => 'object', enabled => 0 }. In/deflation depends on the content type (eg Map[Str,Int]). A Map without a content type would pass through the value unaltered when inflating/deflatin.
{ type => 'object', enabled => 0 }
Map[Str,Int
Map
Clinton Gormley <drtech@cpan.org>
This software is copyright (c) 2012 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Elastic::Model, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Elastic::Model
CPAN shell
perl -MCPAN -e shell install Elastic::Model
For more information on module installation, please visit the detailed CPAN module installation guide.