Skip to content

Commit 73c75de

Browse files
committed
Add changelog, remove total value extraction logic of 7.x
1 parent b5b0817 commit 73c75de

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.3.2
2+
- End of 7.x stack version support. Allow to update elasticsearch-ruby client to 9.x version [#213](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/213)
3+
14
## 4.3.1
25
- Added support for encoded and non encoded api-key formats on plugin configuration [#203](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/203)
36

lib/logstash/filters/elasticsearch/dsl_executor.rb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def process(client, event)
4545
results = client.search(params)
4646
raise "Elasticsearch query error: #{results["_shards"]["failures"]}" if results["_shards"].include? "failures"
4747

48-
event.set("[@metadata][total_hits]", extract_total_from_hits(results['hits']))
48+
event.set("[@metadata][total_hits]", results['hits']['total'])
4949

5050
result_hits = results["hits"]["hits"]
5151
if !result_hits.nil? && !result_hits.empty?
@@ -91,21 +91,6 @@ def process(client, event)
9191
end
9292

9393
private
94-
95-
# Given a "hits" object from an Elasticsearch response, return the total number of hits in
96-
# the result set.
97-
# @param hits [Hash{String=>Object}]
98-
# @return [Integer]
99-
def extract_total_from_hits(hits)
100-
total = hits['total']
101-
102-
# Elasticsearch 7.x produces an object containing `value` and `relation` in order
103-
# to enable unambiguous reporting when the total is only a lower bound; if we get
104-
# an object back, return its `value`.
105-
return total['value'] if total.kind_of?(Hash)
106-
total
107-
end
108-
10994
# get an array of path elements from a path reference
11095
def extract_path(path_reference)
11196
return [path_reference] unless path_reference.start_with?('[') && path_reference.end_with?(']')

0 commit comments

Comments
 (0)