Method: OpenSearch::API::Actions#get
- Defined in:
- lib/opensearch/api/actions/get.rb
#get(arguments = {}) ⇒ Object
Returns a document.
*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/opensearch/api/actions/get.rb', line 52 def get(arguments = {}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] headers = arguments.delete(:headers) || {} arguments = arguments.clone _id = arguments.delete(:id) _index = arguments.delete(:index) method = OpenSearch::API::HTTP_GET path = "#{Utils.__listify(_index)}/_doc/#{Utils.__listify(_id)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } else perform_request(method, path, params, body, headers).body end end |