Class: Elasticated::PartitionedRepository
Instance Attribute Summary collapse
Attributes inherited from Repository
#client
Instance Method Summary
collapse
Methods inherited from Repository
#create_percolator, #delete_by_query, #delete_document, #execute_aggregated_search, #execute_aggregations, #execute_bulk, #execute_count, #execute_search, #exists?, #get_document, #index_document, #percolate_document, #prepare_bulk, #prepare_document, #prepare_search, #prepare_source, #restore_search, #restore_source, #update_document
delegated
Constructor Details
Returns a new instance of PartitionedRepository.
6
7
8
9
|
# File 'lib/elasticated/partitioned_repository.rb', line 6
def initialize(index_selector, opts={})
self.index_selector = index_selector
super opts
end
|
Instance Attribute Details
#index_selector ⇒ Object
Returns the value of attribute index_selector.
4
5
6
|
# File 'lib/elasticated/partitioned_repository.rb', line 4
def index_selector
@index_selector
end
|
Instance Method Details
#affected_index_for(user_params) ⇒ Object
20
21
22
23
24
|
# File 'lib/elasticated/partitioned_repository.rb', line 20
def affected_index_for(user_params)
index_params = user_params.delete(:index_for)
index_params || raise("The index selection parameters should be specified in the missing 'index_for' option")
index_selector.index_for_params index_params
end
|
#affected_indices_for(query) ⇒ Object
16
17
18
|
# File 'lib/elasticated/partitioned_repository.rb', line 16
def affected_indices_for(query)
index_selector.indices_for_query(query)
end
|
#params_for_document(document, original_params = {}) ⇒ Object
26
27
28
29
|
# File 'lib/elasticated/partitioned_repository.rb', line 26
def params_for_document(document, original_params={})
affected_index = index_selector.index_for_document document
original_params.merge index: affected_index
end
|
#params_for_ids(ids, original_params = {}) ⇒ Object
42
43
44
45
|
# File 'lib/elasticated/partitioned_repository.rb', line 42
def params_for_ids(ids, original_params={})
affected_index = affected_index_for original_params
original_params.merge index: affected_index
end
|
#params_for_percolator(original_params = {}) ⇒ Object
47
48
49
50
|
# File 'lib/elasticated/partitioned_repository.rb', line 47
def params_for_percolator(original_params={})
affected_index = index_selector.index_for_percolator
original_params.merge index: affected_index
end
|
#params_for_query(query, original_params = {}) ⇒ Object
31
32
33
34
35
|
# File 'lib/elasticated/partitioned_repository.rb', line 31
def params_for_query(query, original_params={})
affected_indices = affected_indices_for query
affected_indices = affected_indices*','
original_params.merge index: affected_indices
end
|
#params_for_source(source, original_params = {}) ⇒ Object
37
38
39
40
|
# File 'lib/elasticated/partitioned_repository.rb', line 37
def params_for_source(source, original_params={})
affected_index = affected_index_for original_params
original_params.merge index: affected_index
end
|
#refresh_indices_for(query) ⇒ Object
11
12
13
14
|
# File 'lib/elasticated/partitioned_repository.rb', line 11
def refresh_indices_for(query)
affected_indices = affected_indices_for query
client.refresh_indices affected_indices
end
|