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, #max_result_window, #routing_value_for_prepared_record, #searches_could_hit_incomplete_docs?, #to_s
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
36 37 38 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 36 def delete_from_datastore(datastore_client) datastore_client.delete_indices(name) end |
#index_expression_for_search ⇒ Object
49 50 51 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 49 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.
54 55 56 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 54 def index_name_for_writes(record, timestamp_field_path: nil) name end |
#mappings_in_datastore(datastore_client) ⇒ Object
31 32 33 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 31 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).
59 60 61 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 59 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.
45 46 47 |
# File 'lib/elastic_graph/datastore_core/index_definition/index.rb', line 45 def rollover_index_template? false end |