class LogStash::Search::Query

Attributes

count[RW]

The max number of results to return. (like SQL's SELECT … LIMIT n)

offset[RW]

The offset to start at (like SQL's SELECT … OFFSET n)

query_string[RW]

The query string

Public Class Methods

new(settings) click to toggle source

New query object.

'settings' should be a hash containing:

  • :query_string - a string query for searching

  • :offset - (optional, default 0) offset to search from

  • :count - (optional, default 50) max number of results to return

# File lib/logstash/search/query.rb, line 21
def initialize(settings)
  @query_string = settings[:query_string]
  @offset = settings[:offset] || 0
  @count = settings[:count] || 50
end
parse(query_string) click to toggle source

Class method. Parses a query string and returns a LogStash::Search::Query instance

# File lib/logstash/search/query.rb, line 29
def self.parse(query_string)
  # TODO(sissel): I would prefer not to invent my own query language.
  # Can we be similar to Lucene, SQL, or other query languages?
  return self.new(:query_string => query_string)
end