Skip to content

Commit 9ceb428

Browse files
dmitry-gkarmi
authored andcommitted
[API] Added terminate_after parameter to Count action
Add `terminate_after` parameter to the Count action to be able to specify the maximum count for each shard, upon reaching which the query execution will terminate early. Also update the link to Elasic Count API guide. Closes #442 Related: elastic/elasticsearch#26895
1 parent 69ec28d commit 9ceb428

File tree

1 file changed

+6
-2
lines changed
  • elasticsearch-api/lib/elasticsearch/api/actions

1 file changed

+6
-2
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/count.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ module Actions
4242
# to a numeric field) should be ignored
4343
# @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
4444
#
45-
# @see http://elasticsearch.org/guide/reference/api/count/
45+
# @option arguments [Boolean] :terminate_after Specify the maximum count for each shard, upon reaching
46+
# which the query execution will terminate early.
47+
#
48+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
4649
#
4750
def count(arguments={})
4851
valid_params = [
@@ -58,7 +61,8 @@ def count(arguments={})
5861
:default_operator,
5962
:df,
6063
:lenient,
61-
:lowercase_expanded_terms ]
64+
:lowercase_expanded_terms,
65+
:terminate_after ]
6266

6367
method = HTTP_GET
6468
path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_count' )

0 commit comments

Comments
 (0)