Module: ElasticGraph::SchemaArtifacts::ArtifactsHelperMethods

Included in:
FromDisk, ElasticGraph::SchemaDefinition::Results
Defined in:
elasticgraph-schema_artifacts/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 FromDisk and other implementations of the same interface (such as ElasticGraph::SchemaDefinition::Results.

Instance Method Summary collapse

Instance Method Details

#datastore_scriptsHash<String, Hash<String, Object>>

Provides accesses to the datastore scripts, typically written using the painless scripting language.

Returns:

  • (Hash<String, Hash<String, Object>>)


19
20
21
# File 'elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 19

def datastore_scripts
  datastore_config.fetch("scripts")
end

#index_mappings_by_index_def_nameHash<String, Hash<String, Object>>

Provides access to the mappings of both the #index_templates and #indices.

Returns:

  • (Hash<String, Hash<String, Object>>)


42
43
44
45
46
# File 'elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 42

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_templatesHash<String, Hash<String, Object>>

Provides accesses to the datastore index templates, which are used for a rollover index defined using ElasticGraph::SchemaDefinition::Indexing::Index#rollover.

Returns:

  • (Hash<String, Hash<String, Object>>)


27
28
29
# File 'elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 27

def index_templates
  datastore_config.fetch("index_templates")
end

#indicesHash<String, Hash<String, Object>>

Provides accesses to the datastore indices, used for an index that does not rollover.

Returns:

  • (Hash<String, Hash<String, Object>>)


34
35
36
# File 'elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb', line 34

def indices
  datastore_config.fetch("indices")
end