bulk_send

in lib/logstash/outputs/opensearch/http_client.rb [161:180]


    def bulk_send(body_stream, batch_actions)
      params = http_compression ? {:headers => {"Content-Encoding" => "gzip"}} : {}
      response = @pool.post(@bulk_path, params, body_stream.string)

      @bulk_response_metrics.increment(response.code.to_s)

      case response.code
      when 200 
        LogStash::Json.load(response.body)
      when 413 
        logger.warn("Bulk request rejected: `413 Payload Too Large`", :action_count => batch_actions.size, :content_length => body_stream.size)
        emulate_batch_error_response(batch_actions, response.code, 'payload_too_large')
      else
        url = ::LogStash::Util::SafeURI.new(response.final_url)
        raise ::LogStash::Outputs::OpenSearch::HttpClient::Pool::BadResponseCodeError.new(
          response.code, url, body_stream.to_s, response.body
        )
      end
    end