File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
64
64
# Whether results should be sorted or not
65
65
config :enable_sort , :validate => :boolean , :default => true
66
66
67
+ # Whether to set hits to metadata
68
+ config :include_hits , :validate => :boolean , :default => true
69
+
67
70
# How many results to return
68
71
config :result_size , :validate => :number , :default => 1
69
72
@@ -116,6 +119,9 @@ def filter(event)
116
119
117
120
resultsHits = results [ "hits" ] [ "hits" ]
118
121
if !resultsHits . nil? && !resultsHits . empty?
122
+ if @include_hits
123
+ event . set ( "[@metadata][hits]" , resultsHits )
124
+ end
119
125
matched = true
120
126
@fields . each do |old_key , new_key |
121
127
old_key_path = extract_path ( old_key )
You can’t perform that action at this time.
0 commit comments