Class: Leda::Stores::Elasticsearch::Runner
- Inherits:
-
Object
- Object
- Leda::Stores::Elasticsearch::Runner
- Defined in:
- lib/leda/stores/elasticsearch.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#es_client ⇒ Object
readonly
Returns the value of attribute es_client.
-
#indices ⇒ Object
readonly
Returns the value of attribute indices.
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(directory, indices, es_client) ⇒ Runner
constructor
A new instance of Runner.
- #restore ⇒ Object
Constructor Details
#initialize(directory, indices, es_client) ⇒ Runner
Returns a new instance of Runner.
36 37 38 39 40 |
# File 'lib/leda/stores/elasticsearch.rb', line 36 def initialize(directory, indices, es_client) @directory = directory @indices = indices @es_client = es_client end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
34 35 36 |
# File 'lib/leda/stores/elasticsearch.rb', line 34 def directory @directory end |
#es_client ⇒ Object (readonly)
Returns the value of attribute es_client.
34 35 36 |
# File 'lib/leda/stores/elasticsearch.rb', line 34 def es_client @es_client end |
#indices ⇒ Object (readonly)
Returns the value of attribute indices.
34 35 36 |
# File 'lib/leda/stores/elasticsearch.rb', line 34 def indices @indices end |
Instance Method Details
#dump ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/leda/stores/elasticsearch.rb', line 42 def dump $stderr.puts "Exporting to #{echo_fn(directory)} ..." indices.each do |index| (index) scan_all_records_into_bulk_format(index) end $stderr.puts "... export complete." end |
#restore ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/leda/stores/elasticsearch.rb', line 51 def restore $stderr.puts "Importing from #{echo_fn(directory)} ..." indices.each do |index| replace_index(index) bulk_load_records(index) end $stderr.puts "... import complete." end |