Module: Elastic::Types::FacetedType

Included in:
NestedType, Elastic::Type
Defined in:
lib/elastic/types/faceted_type.rb

Instance Method Summary collapse

Instance Method Details

#field(_name, _options = {}) ⇒ Object



12
13
14
# File 'lib/elastic/types/faceted_type.rb', line 12

def field(_name, _options = {})
  pre_definition.register_field Elastic::Fields::Value.new(_name, _options)
end

#fields(*_fields) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
# File 'lib/elastic/types/faceted_type.rb', line 3

def fields(*_fields)
  raise ArgumentError, 'must provide at least a field name' if _fields.empty?

  options = {}
  options = _fields.pop if _fields.last.is_a? Hash

  _fields.each { |name| field(name, options) }
end