mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- send back [@DATE, @LINE] in search results so we can collate results
from multiple indexers
This commit is contained in:
parent
eeeb7b4cd3
commit
344e1a4aef
2 changed files with 3 additions and 4 deletions
|
@ -85,7 +85,7 @@ def main(args)
|
||||||
# Collate & print results.
|
# Collate & print results.
|
||||||
puts "Hits: #{client.hits}"
|
puts "Hits: #{client.hits}"
|
||||||
puts ""
|
puts ""
|
||||||
puts client.results.join("\n")
|
puts client.results.sort_by { |r| r[0] }.collect { |r| r[1] }.join("\n")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -70,7 +70,7 @@ module LogStash; module Net; module Servers
|
||||||
response.indexer_id = @id
|
response.indexer_id = @id
|
||||||
|
|
||||||
if @config.logs[request.log_type].nil?
|
if @config.logs[request.log_type].nil?
|
||||||
puts "invalid log type: #{request.log_type}"
|
$stderr.puts "invalid log type: #{request.log_type}"
|
||||||
response.results = []
|
response.results = []
|
||||||
response.finished = true
|
response.finished = true
|
||||||
yield response
|
yield response
|
||||||
|
@ -79,7 +79,6 @@ module LogStash; module Net; module Servers
|
||||||
|
|
||||||
reader = Ferret::Index::IndexReader.new(@config.logs[request.log_type].index_dir)
|
reader = Ferret::Index::IndexReader.new(@config.logs[request.log_type].index_dir)
|
||||||
search = Ferret::Search::Searcher.new(reader)
|
search = Ferret::Search::Searcher.new(reader)
|
||||||
#puts reader.fields.join(", ")
|
|
||||||
qp = Ferret::QueryParser.new(:fields => reader.fields,
|
qp = Ferret::QueryParser.new(:fields => reader.fields,
|
||||||
:tokenized_fields => reader.tokenized_fields,
|
:tokenized_fields => reader.tokenized_fields,
|
||||||
:or_default => false)
|
:or_default => false)
|
||||||
|
@ -109,7 +108,7 @@ module LogStash; module Net; module Servers
|
||||||
done = false
|
done = false
|
||||||
result = reader[docid][:@LINE]
|
result = reader[docid][:@LINE]
|
||||||
count += 1
|
count += 1
|
||||||
results << result
|
results << [reader[docid][:@DATE], result]
|
||||||
end
|
end
|
||||||
|
|
||||||
if (total and count < limit)
|
if (total and count < limit)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue