Sha256: 3d233978e80d797374176d969c950decb8b42719c19139a73b009d33cc142b29

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

require "logstash/namespace"
require "logstash/logging"

class LogStash::Search::Result
  # Array of LogStash::Event of results
  attr_accessor :events

  # How long this query took, in seconds (or fractions of).
  attr_accessor :duration

  # Offset in search
  attr_accessor :offset

  # Total records matched by this query, regardless of offset/count in query.
  attr_accessor :total

  # Error message, if any.
  attr_accessor :error_message

  def initialize(settings={})
    @events = []
    @duration = nil
    @error_message = nil
  end

  def error?
    return !@error_message.nil?
  end

  def to_json
    return {
      "events" => @events,
      "duration" => @duration,
      "offset" => @offset,
      "total" => @total,
    }.to_json
  end # def to_json
end # class LogStash::Search::Result

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logstash-lite-0.2.20110505142231 lib/logstash/search/result.rb
logstash-lite-0.2.20110422152244 lib/logstash/search/result.rb
logstash-lite-0.2.20110405105201 lib/logstash/search/result.rb
logstash-lite-0.2.20110331121236 lib/logstash/search/result.rb
logstash-lite-0.2.20110329105411 lib/logstash/search/result.rb