Skip to content

Commit

Permalink
add track_total_hits option
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasklinger authored and estolfo committed Nov 5, 2019
1 parent 2267889 commit 0b16c81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/elasticsearch/dsl/search/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Options
:version,
:indices_boost,
:track_scores,
:min_score
:min_score,
:track_total_hits
]

def initialize(*args, &block)
Expand Down
8 changes: 8 additions & 0 deletions test/unit/search_options_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class SearchOptionsTest < ::Elasticsearch::Test::UnitTestCase
assert_equal( { version: true }, subject.to_hash )
end

should "encode track_total_hits" do
subject.track_total_hits 123
assert_equal( { track_total_hits: 123 }, subject.to_hash )

subject.track_total_hits true
assert_equal( { track_total_hits: true }, subject.to_hash )
end

should "encode indices_boost" do
subject.indices_boost foo: 'bar'
assert_equal( { indices_boost: { foo: 'bar' } }, subject.to_hash )
Expand Down

0 comments on commit 0b16c81

Please sign in to comment.