Class: AgnosticBackend::Elasticsearch::Index
- Inherits:
-
Index
- Object
- Index
- AgnosticBackend::Elasticsearch::Index
show all
- Defined in:
- lib/agnostic_backend/elasticsearch/index.rb
Instance Attribute Summary collapse
Attributes inherited from Index
#options
Instance Method Summary
collapse
Methods inherited from Index
#initialize, #name, #parse_option, #primary?
Instance Attribute Details
#enable_all ⇒ Object
Returns the value of attribute enable_all.
5
6
7
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 5
def enable_all
@enable_all
end
|
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5
6
7
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 5
def endpoint
@endpoint
end
|
#index_name ⇒ Object
Returns the value of attribute index_name.
5
6
7
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 5
def index_name
@index_name
end
|
#type ⇒ Object
Returns the value of attribute type.
5
6
7
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 5
def type
@type
end
|
Instance Method Details
26
27
28
29
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 26
def configure
body = mappings(indexer.flatten(schema))
client.send_request(:put, path: "#{index_name}/_mapping/#{type}", body: body)
end
|
#create ⇒ Object
31
32
33
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 31
def create
client.send_request(:put, path: index_name)
end
|
#destroy! ⇒ Object
35
36
37
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 35
def destroy!
client.send_request(:delete, path: index_name)
end
|
#exists? ⇒ Boolean
39
40
41
42
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 39
def exists?
response = client.send_request(:head, path: index_name)
response.success?
end
|
#schema ⇒ Object
18
19
20
|
# File 'lib/agnostic_backend/elasticsearch/index.rb', line 18
def schema
@schema ||= @indexable_klass.schema { |ftype| ftype }
end
|