Module: ElasticGraph::SchemaArtifacts::ArtifactsHelperMethods

Included in:
FromDisk
Defined in:
lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb

Overview

Mixin that offers convenient helper methods on top of the basic schema artifacts. Intended to be mixed into every implementation of the ‘_SchemaArtifacts` interface.

Instance Method Summary collapse

Instance Method Details

#datastore_scriptsObject



14
15
16
# File 'lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 14

def datastore_scripts
  datastore_config.fetch("scripts")
end

#index_mappings_by_index_def_nameObject

Builds a map of index mappings, keyed by index definition name.



27
28
29
30
31
# File 'lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 27

def index_mappings_by_index_def_name
  @index_mappings_by_index_def_name ||= index_templates
    .transform_values { |config| config.fetch("template").fetch("mappings") }
    .merge(indices.transform_values { |config| config.fetch("mappings") })
end

#index_templatesObject



18
19
20
# File 'lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 18

def index_templates
  datastore_config.fetch("index_templates")
end

#indicesObject



22
23
24
# File 'lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 22

def indices
  datastore_config.fetch("indices")
end