Class: ProxES::Request::Multi
- Inherits:
-
ProxES::Request
- Object
- Rack::Request
- ProxES::Request
- ProxES::Request::Multi
- Defined in:
- lib/proxes/request/multi.rb
Constant Summary
Constants inherited from ProxES::Request
Instance Method Summary collapse
-
#body_indices ⇒ Object
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.
- #index=(idx) ⇒ Object
- #indices ⇒ Object
- #indices? ⇒ Boolean
- #parse ⇒ Object
Methods inherited from ProxES::Request
#detail, #duration, #endpoint, from_env, #html?, #initialize, path_endpoint, #user, #user_id
Constructor Details
This class inherits a constructor from ProxES::Request
Instance Method Details
#body_indices ⇒ Object
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
11 12 13 14 15 16 |
# 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) ⇒ Object
18 19 20 21 22 23 24 |
# 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 ⇒ Object
35 36 37 |
# File 'lib/proxes/request/multi.rb', line 35 def indices body_indices + (@index || []) end |
#indices? ⇒ Boolean
31 32 33 |
# File 'lib/proxes/request/multi.rb', line 31 def indices? indices.blank? == false end |
#parse ⇒ Object
26 27 28 29 |
# 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 |