# Define mapping type for nested object in Tire

**URL:** <https://discuss.elastic.co/t/define-mapping-type-for-nested-object-in-tire/11403>\
**Category:** Elasticsearch\
**Created:** [April 1, 2013, 5:28pm UTC](https://discuss.elastic.co/t/define-mapping-type-for-nested-object-in-tire/11403 "2013-04-01T17:28:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Huang](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@Victor\_Huang](https://discuss.elastic.co/u/Victor_Huang)\
**Post date:** [April 1, 2013, 5:28pm UTC](https://discuss.elastic.co/t/define-mapping-type-for-nested-object-in-tire/11403/1 "2013-04-01T17:28:10Z")

</div>

Tire support the loading of the Comment class from the  
PersistentArticleWithCastedCollection object; but i can't find a way to  
define mapping definition for the Comment object. Is there a way to do that  
in Tire?

================  
class PersistentArticleWithCastedCollection  
include Tire::Model::Persistence

property :title  
property :comments, :class =\> [Comment]  
end

class Comment  
include Tire::Model::Persistence  
property :title, :analyzer =\> 'snowball'

def initialize(params); @attributes =  
HashWithIndifferentAccess.new(params); end  
def method\_missing(method\_name, _arguments);  
 @attributes[method\_name]; end  
def as\_json(_);  
@attributes; end  
end

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:43am UTC](https://discuss.elastic.co/t/define-mapping-type-for-nested-object-in-tire/11403/2 "2017-07-06T02:43:22Z")

</div>

Closed on July 6, 2017, 2:43am UTC


