Class: Elastic::Datatypes::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic/datatypes/default.rb

Direct Known Subclasses

Date, String, Term, Time

Constant Summary collapse

MAPPING_OPTIONS =
[
  :type, :analyzer, :boost, :coerce, :copy_to, :doc_values, :dynamic,
  :enabled, :fielddata, :geohash, :geohash_precision, :geohash_prefix, :format, :ignore_above,
  :ignore_malformed, :include_in_all, :index_options, :lat_lon, :index, :fields, :norms,
  :null_value, :position_increment_gap, :properties, :search_analyzer, :similarity, :store,
  :term_vector
]

Instance Method Summary collapse

Constructor Details

#initialize(_name, _options) ⇒ Default

Returns a new instance of Default.



11
12
13
14
# File 'lib/elastic/datatypes/default.rb', line 11

def initialize(_name, _options)
  @name = _name
  @user_options = _options
end

Instance Method Details

#date_histogram_aggregation_defaultsObject



58
59
60
# File 'lib/elastic/datatypes/default.rb', line 58

def date_histogram_aggregation_defaults
  {}
end

#histogram_aggregation_defaultsObject



62
63
64
# File 'lib/elastic/datatypes/default.rb', line 62

def histogram_aggregation_defaults
  {}
end

#mapping_optionsObject



16
17
18
# File 'lib/elastic/datatypes/default.rb', line 16

def mapping_options
  @user_options.slice(*MAPPING_OPTIONS)
end

#match_query_defaultsObject



46
47
48
# File 'lib/elastic/datatypes/default.rb', line 46

def match_query_defaults
  {}
end

#prepare_for_index(_value) ⇒ Object



24
25
26
# File 'lib/elastic/datatypes/default.rb', line 24

def prepare_for_index(_value)
  _value
end

#prepare_for_query(_value) ⇒ Object



20
21
22
# File 'lib/elastic/datatypes/default.rb', line 20

def prepare_for_query(_value)
  prepare_for_index _value
end

#prepare_value_for_result(_value) ⇒ Object



28
29
30
# File 'lib/elastic/datatypes/default.rb', line 28

def prepare_value_for_result(_value)
  _value
end

#range_aggregation_defaultsObject



66
67
68
# File 'lib/elastic/datatypes/default.rb', line 66

def range_aggregation_defaults
  {}
end

#range_query_defaultsObject



50
51
52
# File 'lib/elastic/datatypes/default.rb', line 50

def range_query_defaults
  {}
end

#supported_aggregationsObject



32
33
34
# File 'lib/elastic/datatypes/default.rb', line 32

def supported_aggregations
  [:terms, :histogram, :range]
end

#supported_queriesObject



36
37
38
# File 'lib/elastic/datatypes/default.rb', line 36

def supported_queries
  [:term, :range]
end

#term_query_defaultsObject

default configurations



42
43
44
# File 'lib/elastic/datatypes/default.rb', line 42

def term_query_defaults
  {}
end

#terms_aggregation_defaultsObject



54
55
56
# File 'lib/elastic/datatypes/default.rb', line 54

def terms_aggregation_defaults
  { size: 10000 } # amount of groups to return by default
end