Skip to content

Commit 07087ee

Browse files
committed
Revert "revert incorrect changes in aggs"
This reverts commit baf7065.
1 parent 53db3bf commit 07087ee

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/logstash/inputs/elasticsearch/aggregation.rb

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ def initialize(client, plugin)
1313
@plugin_params = plugin.params
1414

1515
@size = @plugin_params["size"]
16-
@query = @plugin_params["query"]
1716
@retries = @plugin_params["retries"]
18-
@agg_options = {
19-
:index => @plugin_params["index"],
20-
:size => 0
21-
}.merge(:body => @query)
22-
2317
@plugin = plugin
2418
end
2519

@@ -33,10 +27,18 @@ def retryable(job_name, &block)
3327
false
3428
end
3529

36-
def do_run(output_queue)
30+
def aggregation_options(query_object)
31+
{
32+
:index => @index,
33+
:size => 0,
34+
:body => query_object
35+
}
36+
end
37+
38+
def do_run(output_queue, query_object)
3739
logger.info("Aggregation starting")
3840
r = retryable(AGGREGATION_JOB) do
39-
@client.search(@agg_options)
41+
@client.search(aggregation_options(query_object))
4042
end
4143
@plugin.push_hit(r, output_queue, 'aggregations') if r
4244
end

0 commit comments

Comments
 (0)