Class: ElasticGraph::DatastoreCore::IndexDefinition::Index
- Inherits:
-
Object
- Object
- ElasticGraph::DatastoreCore::IndexDefinition::Index
- Includes:
- Base
- Defined in:
- lib/elastic_graph/datastore_core/index_definition/index.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#delete_from_datastore(datastore_client) ⇒ Object
‘ignore_unavailable: true` is needed to prevent errors when we delete non-existing non-rollover indices.
- #index_expression_for_search ⇒ Object
-
#index_name_for_writes(record, timestamp_field_path: nil) ⇒ Object
Returns an index name to use for write operations.
- #mappings_in_datastore(datastore_client) ⇒ Object
-
#related_rollover_indices(datastore_client, only_if_exists: false) ⇒ Object
A concrete index has no related indices (really only rollover indices do).
-
#rollover_index_template? ⇒ Boolean
Indicates if this is a rollover index definition.
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_search ⇒ Object
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 |
#related_rollover_indices(datastore_client, only_if_exists: false) ⇒ Object
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 (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.
44 45 46 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 44 def rollover_index_template? false end |