class Fields
Constants
- BASE_MAPPING
- OPTIONS_MAPPING
- TYPE_MAPPING
Public Class Methods
new()
click to toggle source
# File lib/es_fields/fields.rb, line 29 def initialize @base_mapping = BASE_MAPPING.dup end
Public Instance Methods
field(name, type, options: [])
click to toggle source
# File lib/es_fields/fields.rb, line 33 def field(name, type, options: []) @base_mapping[:mappings][:doc][:properties].merge!( { name => { type: options.empty? ? TYPE_MAPPING[type] : OPTIONS_MAPPING[options.first] } } ) @base_mapping end