Class: Esse::CLI::Index
  
  
  
  
  
    - Inherits:
 
    - 
      Base
      
        
          - Object
 
          
            - Thor
 
          
            - Base
 
          
            - Esse::CLI::Index
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/esse/cli/index.rb
 
  
  
 
Defined Under Namespace
  
    
  
    
      Classes: BaseOperation, Close, Create, Delete, Import, Open, Reset, UpdateAliases, UpdateMapping, UpdateSettings
    
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
    Instance Method Details
    
      
  
  
    #close(*index_classes)  ⇒ Object 
  
  
  
  
    
      
84
85
86
87 
     | 
    
      # File 'lib/esse/cli/index.rb', line 84
def close(*index_classes)
  require_relative 'index/close'
  Close.new(indices: index_classes, **options.to_h.transform_keys(&:to_sym)).run
end 
     | 
  
 
    
      
  
  
    #create(*index_classes)  ⇒ Object 
  
  
  
  
    
      
41
42
43
44
45 
     | 
    
      # File 'lib/esse/cli/index.rb', line 41
def create(*index_classes)
  require_relative 'index/create'
  opts = HashUtils.deep_transform_keys(options.to_h, &:to_sym)
  Create.new(indices: index_classes, **opts).run
end 
     | 
  
 
    
      
  
  
    #delete(*index_classes)  ⇒ Object 
  
  
  
  
    
      
49
50
51
52 
     | 
    
      # File 'lib/esse/cli/index.rb', line 49
def delete(*index_classes)
  require_relative 'index/delete'
  Delete.new(indices: index_classes, **options.to_h.transform_keys(&:to_sym)).run
end 
     | 
  
 
    
      
  
  
    #import(*index_classes)  ⇒ Object 
  
  
  
  
    
      
104
105
106
107
108
109
110
111
112
113 
     | 
    
      # File 'lib/esse/cli/index.rb', line 104
def import(*index_classes)
  require_relative 'index/import'
  opts = HashUtils.deep_transform_keys(options.to_h, &:to_sym)
  %i[preload_lazy_attributes eager_load_lazy_attributes update_lazy_attributes].each do |key|
    if (val = opts.delete(key)) && val != 'false'
      opts[key] = (val == 'true') ? true : val.split(',')
    end
  end
  Import.new(indices: index_classes, **opts).run
end
     | 
  
 
    
      
  
  
    #open(*index_classes)  ⇒ Object 
  
  
  
  
    
      
91
92
93
94 
     | 
    
      # File 'lib/esse/cli/index.rb', line 91
def open(*index_classes)
  require_relative 'index/open'
  Open.new(indices: index_classes, **options.to_h.transform_keys(&:to_sym)).run
end 
     | 
  
 
    
      
  
  
    #reset(*index_classes)  ⇒ Object 
  
  
  
  
    
      
22
23
24
25
26
27
28
29 
     | 
    
      # File 'lib/esse/cli/index.rb', line 22
def reset(*index_classes)
  require_relative 'index/reset'
  opts = HashUtils.deep_transform_keys(options.to_h, &:to_sym)
  if opts[:import] && opts[:reindex]
    raise ArgumentError, 'You cannot use --import and --reindex together'
  end
  Reset.new(indices: index_classes, **opts).run
end
     | 
  
 
    
      
  
  
    #update_aliases(*index_classes)  ⇒ Object 
  
  
  
  
    
      
56
57
58
59
60
61
62 
     | 
    
      # File 'lib/esse/cli/index.rb', line 56
def update_aliases(*index_classes)
  require_relative 'index/update_aliases'
  kwargs = options.to_h.transform_keys(&:to_sym)
  kwargs[:suffix] = (kwargs[:suffix] || []).flat_map { |s| s.split(',') }.uniq
  UpdateAliases.new(indices: index_classes, **kwargs).run
end
     | 
  
 
    
      
  
  
    #update_mapping(*index_classes)  ⇒ Object 
  
  
  
  
    
      
77
78
79
80 
     | 
    
      # File 'lib/esse/cli/index.rb', line 77
def update_mapping(*index_classes)
  require_relative 'index/update_mapping'
  UpdateMapping.new(indices: index_classes, **options.to_h.transform_keys(&:to_sym)).run
end 
     | 
  
 
    
      
  
  
    #update_settings(*index_classes)  ⇒ Object 
  
  
  
  
    
      
68
69
70
71
72 
     | 
    
      # File 'lib/esse/cli/index.rb', line 68
def update_settings(*index_classes)
  require_relative 'index/update_settings'
  opts = HashUtils.deep_transform_keys(options.to_h, &:to_sym)
  UpdateSettings.new(indices: index_classes, **opts).run
end 
     |