Sha256: 0bfe4160c844c7d4e57c104559678c1e6849b4ef03beba45bc4332d68cc1b380
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true require 'proxes/request' module ProxES class Request class Multi < Request # Read up on URL-based access control - https://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 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 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 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 def indices? indices.blank? == false end def indices body_indices + (@index || []) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proxes-0.10.1 | lib/proxes/request/multi.rb |