class Elasticsearch::Resources::Type

Constants

ACTIONS

Public Class Methods

document_class() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 84
def self.document_class
  Object.const_get(@document_class) if @document_class
end
new(index:, &block) click to toggle source
# File lib/elasticsearch/resources/type.rb, line 20
def initialize(index:, &block)
  self.index = index
  configure(&block)
end

Protected Class Methods

define_document(document_class) click to toggle source
# File lib/elasticsearch/resources/type.rb, line 90
def self.define_document(document_class)
  @document_class = (document_class.class == Class ? document_class.name : document_class)
end

Public Instance Methods

client() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 29
def client
  index.client
end
cluster() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 25
def cluster
  index.cluster
end
count(body, options = {}) click to toggle source
# File lib/elasticsearch/resources/type.rb, line 54
def count(body, options = {})
  params = {
    body: body
  }.merge(options)

  query(:count, params)
end
document_class() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 80
def document_class
  self.class.document_class
end
find_cluster() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 68
def find_cluster
  self.cluster
end
find_index(index: nil) click to toggle source
# File lib/elasticsearch/resources/type.rb, line 72
def find_index(index: nil)
  self.index
end
find_type(index: nil, type:) click to toggle source
# File lib/elasticsearch/resources/type.rb, line 76
def find_type(index: nil, type:)
  matches_name?(type) ? self : nil
end
name() click to toggle source
# File lib/elasticsearch/resources/type.rb, line 33
def name
  settings.name
end
query(action, options = {}) click to toggle source
Calls superclass method
# File lib/elasticsearch/resources/type.rb, line 37
def query(action, options = {})
  params = {
    index: index.name,
    type: name
  }.merge(options)

  super(action, **params)
end