Elastic::Model::TypeMap::Default - The default type map used by Elastic::Model
version 0.52
Moose's type constraints and introspection allows Elastic::Model to figure out how to map your data model to the Elasticsearch backend with the minimum of effort on your part.
What YOU need to do is: Be specific about the type constraint for each attribute.
For instance, if you have an attribute called count, then specify the type constraint isa => 'Int'. That way, we know how to define the field in Elasticsearch, and how to deflate and inflate the value.
count
isa => 'Int'
Type constraints can inherit their mapping, inflator and deflator from their parent type-constraints. For instance, if you were to assign count the type constraint PositiveInt, although we don't know about that constraint, we do know about its parent, Int, so we could still handle the field correctly.
PositiveInt
Int
Type maps are used to define:
what mapping Elastic::Model will generate for each attribute when you create an index or update the mapping of an existing index.
how Elastic::Model will deflate and inflate each attribute when saving or retrieving docs stored in Elasticsearch.
Elastic::Model::TypeMap::Default loads the following type-maps.
Elastic::Model::TypeMap::Moose
Elastic::Model::TypeMap::Objects
Elastic::Model::TypeMap::Structured
Elastic::Model::TypeMap::ES
Elastic::Model::TypeMap::Common
See Elastic::Model::TypeMap::Base for instructions on how to define your own type-map classes.
See Elastic::Manual::Attributes for keywords you can use in your attribute declarations to tweak the mapping of individual fields.
Clinton Gormley <drtech@cpan.org>
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.
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.