Skip to content

Commit 0b16c81

Browse files
andreasklingerestolfo
authored andcommitted
add track_total_hits option
1 parent 2267889 commit 0b16c81

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/elasticsearch/dsl/search/options.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class Options
2121
:version,
2222
:indices_boost,
2323
:track_scores,
24-
:min_score
24+
:min_score,
25+
:track_total_hits
2526
]
2627

2728
def initialize(*args, &block)

test/unit/search_options_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ class SearchOptionsTest < ::Elasticsearch::Test::UnitTestCase
6464
assert_equal( { version: true }, subject.to_hash )
6565
end
6666

67+
should "encode track_total_hits" do
68+
subject.track_total_hits 123
69+
assert_equal( { track_total_hits: 123 }, subject.to_hash )
70+
71+
subject.track_total_hits true
72+
assert_equal( { track_total_hits: true }, subject.to_hash )
73+
end
74+
6775
should "encode indices_boost" do
6876
subject.indices_boost foo: 'bar'
6977
assert_equal( { indices_boost: { foo: 'bar' } }, subject.to_hash )

0 commit comments

Comments
 (0)