Class: ElasticRecord::Index

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

Defined Under Namespace

Modules: Documents, Manage, Mapping

Instance Attribute Summary collapse

Instance Method Summary collapse

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_add, #delete_record, #index_record, #record_exists?

Constructor Details

#initialize(model) ⇒ Index

Returns a new instance of Index.



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

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

Instance Attribute Details

#disabledObject

Returns the value of attribute disabled.



12
13
14
# File 'lib/elastic_record/index.rb', line 12

def disabled
  @disabled
end

#modelObject

Returns the value of attribute model.



11
12
13
# File 'lib/elastic_record/index.rb', line 11

def model
  @model
end

Instance Method Details

#alias_nameObject



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

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

#disable!Object



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

def disable!
  @disabled = true
end

#enable!Object



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

def enable!
  @disabled = false
end

#typeObject



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

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