Class: Arelastic::Mappings::MultiField

Inherits:
Type show all
Defined in:
lib/arelastic/mappings/types/multi_field.rb

Instance Attribute Summary collapse

Attributes inherited from Type

#options

Instance Method Summary collapse

Methods inherited from Type

for_type

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(field, field_mappings) ⇒ MultiField

Returns a new instance of MultiField.



5
6
7
8
# File 'lib/arelastic/mappings/types/multi_field.rb', line 5

def initialize(field, field_mappings)
  @field = field
  @field_mappings = field_mappings
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



4
5
6
# File 'lib/arelastic/mappings/types/multi_field.rb', line 4

def field
  @field
end

#field_mappingsObject (readonly)

Returns the value of attribute field_mappings.



4
5
6
# File 'lib/arelastic/mappings/types/multi_field.rb', line 4

def field_mappings
  @field_mappings
end

Instance Method Details

#as_elasticObject



10
11
12
13
14
15
16
17
# File 'lib/arelastic/mappings/types/multi_field.rb', line 10

def as_elastic
  {
    field => {
      'type'    => 'multi_field',
      'fields'  => field_mappings
    }
  }
end