From 0b16c8143a2330b3db648ce86bbf185f22967d26 Mon Sep 17 00:00:00 2001 From: Andreas Klinger Date: Tue, 15 Oct 2019 11:51:18 -0700 Subject: [PATCH] add track_total_hits option --- lib/elasticsearch/dsl/search/options.rb | 3 ++- test/unit/search_options_test.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/elasticsearch/dsl/search/options.rb b/lib/elasticsearch/dsl/search/options.rb index 9c8e0d0..1ba290a 100644 --- a/lib/elasticsearch/dsl/search/options.rb +++ b/lib/elasticsearch/dsl/search/options.rb @@ -21,7 +21,8 @@ class Options :version, :indices_boost, :track_scores, - :min_score + :min_score, + :track_total_hits ] def initialize(*args, &block) diff --git a/test/unit/search_options_test.rb b/test/unit/search_options_test.rb index 58d32f3..c6334f8 100644 --- a/test/unit/search_options_test.rb +++ b/test/unit/search_options_test.rb @@ -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 )