Module: ElasticGraph::DatastoreCore::IndexDefinition
- Defined in:
- lib/elastic_graph/datastore_core/index_definition.rb,
lib/elastic_graph/datastore_core/index_definition/base.rb,
lib/elastic_graph/datastore_core/index_definition/index.rb,
lib/elastic_graph/datastore_core/index_definition/rollover_index.rb,
lib/elastic_graph/datastore_core/index_definition/rollover_index_template.rb
Overview
Represents the definition of a datastore index (or rollover template). Intended to be an entry point for working with datastore indices.
This module contains common implementation logic for both the rollover and non-rollover case, as well as a ‘with` factory method.
Defined Under Namespace
Modules: Base Classes: Index, RolloverIndex, RolloverIndexTemplate
Class Method Summary collapse
Class Method Details
.with(name:, runtime_metadata:, config:, datastore_clients_by_name:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elastic_graph/datastore_core/index_definition.rb', line 21 def self.with(name:, runtime_metadata:, config:, datastore_clients_by_name:) if (env_index_config = config.index_definitions[name]).nil? raise ConfigError, "Configuration does not provide an index definition for `#{name}`, " \ "but it is required so we can identify the datastore cluster(s) to query and index into." end common_args = { name: name, route_with: .route_with, default_sort_clauses: .default_sort_fields.map(&:to_query_clause), current_sources: .current_sources, fields_by_path: .fields_by_path, env_index_config: env_index_config, defined_clusters: config.clusters.keys.to_set, datastore_clients_by_name: datastore_clients_by_name } if (rollover = .rollover) RolloverIndexTemplate.new( timestamp_field_path: rollover., frequency: rollover.frequency, index_args: common_args, **common_args ) else Index.new(**common_args) end end |