Class: ActiveRecord::ConnectionAdapters::Elasticsearch::TableSettingDefinition
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Elasticsearch::TableSettingDefinition
- Includes:
- ActiveModel::Validations, AttributeMethods
- Defined in:
- lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb
Constant Summary collapse
- IGNORE_NAMES =
exclude settings, that are provided through the API but are not part of the index-settings API
['provided_name', 'creation_date', 'uuid', 'version','routing.allocation.initial_recovery','resize'].freeze
- FINAL_NAMES =
final names can only be set during index creation
['number_of_shards', 'routing_partition_size', 'soft_deletes.enabled'].freeze
- STATIC_NAMES =
static names can only be set during index creation or closed
['number_of_routing_shards', 'codec', 'soft_deletes.retention_lease.period', 'load_fixed_bitset_filters_eagerly', 'shard.check_on_startup', # modules 'analysis', 'routing', 'unassigned', 'merge', 'similarity', 'search', 'store', 'translog', 'indexing_pressure'].freeze
- DYNAMIC_NAMES =
dynamic names can always be changed
['number_of_replicas', 'auto_expand_replicas', "search.idle.after", 'refresh_interval', 'max_result_window', 'max_inner_result_window', 'max_rescore_window', 'max_docvalue_fields_search', 'max_script_fields', 'max_ngram_diff', 'max_shingle_diff', 'max_refresh_listeners', 'analyze.max_token_count', 'highlight.max_analyzed_offset', 'max_terms_count', 'max_regex_length', 'query.default_field', 'routing.allocation.enable', 'routing.rebalance.enable', 'gc_deletes', 'default_pipeline', 'final_pipeline', 'hidden', 'blocks'].freeze
- VALID_NAMES =
(FINAL_NAMES + STATIC_NAMES + DYNAMIC_NAMES).freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
attributes.
-
#state ⇒ Object
included
from AttributeMethods
readonly
Returns the value of attribute state.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
- .match_dynamic_names?(name) ⇒ Boolean
- .match_final_names?(name) ⇒ Boolean
- .match_ignore_names?(name) ⇒ Boolean
- .match_static_names?(name) ⇒ Boolean
- .match_valid_names?(name) ⇒ Boolean
Instance Method Summary collapse
- #dynamic? ⇒ Boolean
- #error_messages ⇒ Object included from AttributeMethods
- #final? ⇒ Boolean
-
#flat_names ⇒ Object
returns a array of flat names.
-
#initialize(name, value) ⇒ TableSettingDefinition
constructor
A new instance of TableSettingDefinition.
- #state? ⇒ Boolean included from AttributeMethods
- #static? ⇒ Boolean
- #with_state(state) ⇒ Object included from AttributeMethods
Constructor Details
#initialize(name, value) ⇒ TableSettingDefinition
Returns a new instance of TableSettingDefinition.
74 75 76 77 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 74 def initialize(name, value) @name = name.to_s @value = value end |
Instance Attribute Details
#name ⇒ Object
attributes
42 43 44 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 42 def name @name end |
#state ⇒ Object (readonly) Originally defined in module AttributeMethods
Returns the value of attribute state.
#value ⇒ Object
Returns the value of attribute value.
43 44 45 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 43 def value @value end |
Class Method Details
.match_dynamic_names?(name) ⇒ Boolean
66 67 68 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 66 def self.match_dynamic_names?(name) DYNAMIC_NAMES.any? { |invalid| name.match?(invalid) } end |
.match_final_names?(name) ⇒ Boolean
62 63 64 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 62 def self.match_final_names?(name) FINAL_NAMES.any? { |invalid| name.match?(invalid) } end |
.match_ignore_names?(name) ⇒ Boolean
54 55 56 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 54 def self.match_ignore_names?(name) IGNORE_NAMES.any? { |invalid| name.match?(invalid) } end |
.match_static_names?(name) ⇒ Boolean
70 71 72 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 70 def self.match_static_names?(name) STATIC_NAMES.any? { |invalid| name.match?(invalid) } end |
.match_valid_names?(name) ⇒ Boolean
58 59 60 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 58 def self.match_valid_names?(name) VALID_NAMES.any? { |invalid| name.match?(invalid) } end |
Instance Method Details
#dynamic? ⇒ Boolean
89 90 91 92 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 89 def dynamic? @dynamic = flat_names.all? { |flat_name| self.class.match_dynamic_names?(flat_name) } if @dynamic.nil? @dynamic end |
#error_messages ⇒ Object Originally defined in module AttributeMethods
#final? ⇒ Boolean
79 80 81 82 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 79 def final? @final = flat_names.all? { |flat_name| self.class.match_final_names?(flat_name) } if @final.nil? @final end |
#flat_names ⇒ Object
returns a array of flat names
95 96 97 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 95 def flat_names @flat_names ||= _generate_flat_names.uniq end |
#state? ⇒ Boolean Originally defined in module AttributeMethods
#static? ⇒ Boolean
84 85 86 87 |
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/table_setting_definition.rb', line 84 def static? @static = flat_names.all? { |flat_name| self.class.match_static_names?(flat_name) } if @static.nil? @static end |