Class: ElasticGraph::DatastoreCore::IndexDefinition::Index

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/elastic_graph/datastore_core/index_definition/index.rb

Direct Known Subclasses

RolloverIndex

Instance Method Summary collapse

Methods included from Base

#accessible_cluster_names_to_index_into, #accessible_from_queries?, #all_accessible_cluster_names, #cluster_to_query, #clusters_to_index_into, #flattened_env_setting_overrides, #has_custom_routing?, #ignored_values_for_routing, #known_related_query_rollover_indices, #list_counts_field_paths_for_source, #routing_value_for_prepared_record, #searches_could_hit_incomplete_docs?, #to_s, #use_updates_for_indexing?

Instance Method Details

#delete_from_datastore(datastore_client) ⇒ Object

‘ignore_unavailable: true` is needed to prevent errors when we delete non-existing non-rollover indices



35
36
37
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 35

def delete_from_datastore(datastore_client)
  datastore_client.delete_indices(name)
end

#index_expression_for_searchObject



48
49
50
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 48

def index_expression_for_search
  name
end

#index_name_for_writes(record, timestamp_field_path: nil) ⇒ Object

Returns an index name to use for write operations.



53
54
55
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 53

def index_name_for_writes(record, timestamp_field_path: nil)
  name
end

#mappings_in_datastore(datastore_client) ⇒ Object



30
31
32
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 30

def mappings_in_datastore(datastore_client)
  IndexConfigNormalizer.normalize_mappings(datastore_client.get_index(name)["mappings"] || {})
end

A concrete index has no related indices (really only rollover indices do).



58
59
60
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 58

def related_rollover_indices(datastore_client, only_if_exists: false)
  []
end

#rollover_index_template?Boolean

Indicates if this is a rollover index definition.

Use of this is considered a mild code smell. When feasible, it’s generally better to implement a new polymorphic API on the IndexDefinition interface, rather then branching on the value of this predicate.

Returns:

  • (Boolean)


44
45
46
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 44

def rollover_index_template?
  false
end