Class: Elasticshell::Scopes::Mapping

Inherits:
Elasticshell::Scope show all
Includes:
HasName
Defined in:
lib/elasticshell/scopes/mapping.rb

Constant Summary

Constants included from HasName

HasName::FORBIDDEN_NAME_CHARS

Constants included from HasVerb

HasVerb::VERBS

Instance Attribute Summary collapse

Attributes included from HasName

#name

Attributes inherited from Elasticshell::Scope

#client, #last_refresh_at, #path, #scopes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Elasticshell::Scope

#completing_scope_path_and_prefix, #completion_proc, #fetch_scopes, #initial_scopes, #refresh, #refresh!, #refreshed?, #request_names, #requests, #requests_matching, #reset!, #scopes_matching, #to_s

Methods included from HasVerb

#verb, #verb=

Constructor Details

#initialize(index, name, options = {}) ⇒ Mapping

Returns a new instance of Mapping.



11
12
13
14
15
# File 'lib/elasticshell/scopes/mapping.rb', line 11

def initialize index, name, options={}
  self.index = index
  self.name  = name
  super("/#{index.name}/#{self.name}", options)
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



9
10
11
# File 'lib/elasticshell/scopes/mapping.rb', line 9

def index
  @index
end

Class Method Details

.requestsObject



17
18
19
20
21
22
23
24
25
# File 'lib/elasticshell/scopes/mapping.rb', line 17

def self.requests
  @requests ||= {
    "GET" => {
      "_search"  => "Search records within this mapping.",
      "_mapping" => "Retrieve the mapping settings for this mapping.",
      "_count"   => "Count records within this mapping.",
    }
  }
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/elasticshell/scopes/mapping.rb', line 27

def exists?
  index.refresh
  index.scopes.include?(name)
end