NAME
Elastic::Model::TypeMap::Moose - Type maps for core Moose types
VERSION
version 0.52
DESCRIPTION
Elastic::Model::TypeMap::Moose provides mapping, inflation and deflation for the core Moose::Util::TypeConstraints and MooseX::Type::Moose types. It is loaded automatically by Elastic::Model::TypeMap::Default.
Definitions are inherited from parent type constraints, so a specific mapping may be provided for "Int" but the deflation and inflation is handled by "Any".
TYPES
Any
No deflation or inflation is attempted - the value is passed unaltered. If it is not a value that JSON::XS can handle (eg a blessed value) then deflation will fail.
It is mapped as: { type => 'object', enabled => 0 }
.
Item
Mapping and in/deflation via "Any".
Bool
In/deflation via "Any". It is mapped as:
{
type => 'boolean',
null_value => 0
}
Maybe
An undef value is stored as a JSON null
. The mapping and in/deflation depend on the content type, eg Maybe[Int]
. A Maybe
without a content type is mapped and in/deflated via "Any". Maybe[Bool]
is special cased to be mapped as:
{ type => 'boolean' }
See "BOOLEAN FIELDS" in Elastic::Manual::Attributes for an explanation.
Undef
Mapped as { type => 'string', index => 'not_analyzed' }
. In/deflation via "Any".
Defined
Mapping and in/deflation via "Any".
Value
Mapping and in/deflation via "Any".
Str
Mapped as { type => 'string' }
. In/deflation via "Any".
Enum
Values are passed through without inflation/deflation. Mapped as:
{
type => 'string',
index => 'not_analyzed'
}
Num
Mapped as { type => 'float' }
. In/deflation via "Any".
Int
Mapped as { type => 'long' }
. In/deflation via "Any".
Ref
No delator, inflator or mapping provided.
ScalarRef
The scalar value is dereferenced on deflation, and converted back to a scalar ref on inflation. The mapping depends on the content type, eg ScalarRef[Int]
. A ScalarRef
without a content type is mapped via "Any".
ArrayRef
An array ref is preserved on inflation/deflation. The mapping depends on the content type, eg ArrayRef[Int]
. An ArrayRef
without a content type is mapped and in/deflated via "Any". For array refs with elements of different types, see "Tuple" in Elastic::Model::TypeMap::Structured.
HashRef
A hash ref is preserved on inflation/deflation. 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, HashRefs are mapped as { type => 'object', enabled => 0 }
. In/deflation depends on the content type (eg HashRef[Int
]). A HashRef
without a content type is in/deflated via "Any".
If you need a hashref which is indexed, then rather use either an object or "Dict" in Elastic::Model::TypeMap::Structure.
Ref
No delator, inflator or mapping provided.
RegexpRef
No delator or inflator is provided. It is mapped as: { type => 'string', index => 'no' }
.
GlobRef
No delator, inflator or mapping provided.
FileHandle
No delator, inflator or mapping provided.
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.