NAME
Elastic::Model::TypeMap::Structured - Type maps for MooseX::Types::Structured
VERSION
version 0.52
DESCRIPTION
Elastic::Model::TypeMap::Structured provides mapping, inflation and deflation for the MooseX::Types::Structured type constraints. It is loaded automatically byElastic::Model::TypeMap::Default.
TYPES
Optional
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.
Tuple
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' }
.
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.
Dict
A Dict
is mapped as an object, with:
{
type => 'object',
dynamic => 'strict',
properties => \%properties
}
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.
Map
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.
AUTHOR
Clinton Gormley <drtech@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 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.