Class: ElasticRecord::Index

Inherits:
Object
  • Object
show all
Includes:
Deferred, Documents, Manage, Mapping, Percolator
Defined in:
lib/elastic_record/index.rb,
lib/elastic_record/index/manage.rb,
lib/elastic_record/index/mapping.rb,
lib/elastic_record/index/deferred.rb,
lib/elastic_record/index/documents.rb,
lib/elastic_record/index/percolator.rb

Defined Under Namespace

Modules: Deferred, Documents, Manage, Mapping, Percolator

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Deferred

#connection, #deferred_connection, #disable_deferring!, #enable_deferring!, #reset_deferring!

Methods included from Percolator

#create_percolator, #delete_percolator, #percolate, #percolator_exists?, #percolator_index_name, #reset_percolator

Methods included from Mapping

#mapping, #mapping=

Methods included from Manage

#aliased_names, #all_names, #create, #create_and_deploy, #delete, #delete_all, #deploy, #exists?, #refresh, #reset, #update_mapping

Methods included from Documents

#bulk, #bulk_add, #delete_document, #explain, #index_document, #record_exists?, #scroll, #search

Constructor Details

#initialize(model) ⇒ Index

Returns a new instance of Index.



19
20
21
22
# File 'lib/elastic_record/index.rb', line 19

def initialize(model)
  @model = model
  @disabled = false
end

Instance Attribute Details

#disabledObject

Returns the value of attribute disabled.



17
18
19
# File 'lib/elastic_record/index.rb', line 17

def disabled
  @disabled
end

#modelObject

Returns the value of attribute model.



16
17
18
# File 'lib/elastic_record/index.rb', line 16

def model
  @model
end

Instance Method Details

#alias_nameObject



24
25
26
# File 'lib/elastic_record/index.rb', line 24

def alias_name
  @alias_name ||= model.base_class.model_name.collection
end

#disable!Object



32
33
34
# File 'lib/elastic_record/index.rb', line 32

def disable!
  @disabled = true
end

#enable!Object



36
37
38
# File 'lib/elastic_record/index.rb', line 36

def enable!
  @disabled = false
end

#real_connectionObject



40
41
42
# File 'lib/elastic_record/index.rb', line 40

def real_connection
  model.elastic_connection
end

#typeObject



28
29
30
# File 'lib/elastic_record/index.rb', line 28

def type
  @type ||= model.base_class.model_name.element
end