module Elastic::Types::NestableType
Public Instance Methods
nested(_name, using: nil, target: nil, &_block)
click to toggle source
# File lib/elastic/types/nestable_type.rb, line 3 def nested(_name, using: nil, target: nil, &_block) unless _block.nil? using = Class.new(Elastic::NestedType, &_block) using.target = (target || _name.to_s.singularize.camelize.constantize) rescue nil end using = (_name.to_s.singularize + '_index').camelize.constantize if using.nil? pre_definition.register_field Elastic::Fields::Nested.new(_name, using) end