Class: Elasticated::Mapping::Fields::FieldWithDocValues

Inherits:
StandardField
  • Object
show all
Defined in:
lib/elasticated/mapping/fields/field_with_doc_values.rb

Instance Attribute Summary collapse

Attributes inherited from StandardField

#name

Instance Method Summary collapse

Methods inherited from StandardField

#build

Constructor Details

#initialize(name, doc_values = true) ⇒ FieldWithDocValues

Returns a new instance of FieldWithDocValues.



8
9
10
11
# File 'lib/elasticated/mapping/fields/field_with_doc_values.rb', line 8

def initialize(name, doc_values=true)
  super(name)
  self.doc_values = doc_values
end

Instance Attribute Details

#doc_valuesObject

Returns the value of attribute doc_values.



6
7
8
# File 'lib/elasticated/mapping/fields/field_with_doc_values.rb', line 6

def doc_values
  @doc_values
end

Instance Method Details

#build_bodyObject



13
14
15
16
17
# File 'lib/elasticated/mapping/fields/field_with_doc_values.rb', line 13

def build_body
  body = super
  body[:fielddata] = { format: :doc_values } if doc_values
  body
end