class ProxES::Request::Multi

Public Instance Methods

body_indices() click to toggle source

Read up on URL-based access control - www.elastic.co/guide/en/elasticsearch/reference/current/url-access-control.html Setting `rest.action.multi.allow_explicit_index` to false will not allow the user to send an index in the request body which negates this. Depending on your needs, you can enable / disable this

# File lib/proxes/request/multi.rb, line 11
def body_indices
  # TODO: Do / Don't do this depending on rest.action.multi.allow_explicit_index
  @body_indices ||= begin
    body.read.scan(self.class.indices_regex).tap { |_r| body.rewind }
  end.map { |e| e[1] }.compact.uniq
end
index=(idx) click to toggle source
# File lib/proxes/request/multi.rb, line 18
def index=(idx)
  @body_indices = []
  @index = idx
  self.path_info = '/' + [index, type, endpoint].compact
                                                .map { |v| v.is_a?(Array) ? v.join(',') : v }
                                                .select { |v| !v.nil? && v != '' }.join('/')
end
indices() click to toggle source
# File lib/proxes/request/multi.rb, line 35
def indices
  body_indices + (@index || [])
end
indices?() click to toggle source
# File lib/proxes/request/multi.rb, line 31
def indices?
  indices.blank? == false
end
parse() click to toggle source
# File lib/proxes/request/multi.rb, line 26
def parse
  @index ||= check_part(path_parts[0]) unless path_parts[0] == endpoint
  @type  ||= check_part(path_parts[1]) unless path_parts[1] == endpoint
end