File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,6 @@ def _clone(self):
294
294
s = self .__class__ (
295
295
using = self ._using , index = self ._index , doc_type = self ._doc_type
296
296
)
297
- s ._collapse = self ._collapse .copy ()
298
297
s ._doc_type_map = self ._doc_type_map .copy ()
299
298
s ._extra = self ._extra .copy ()
300
299
s ._params = self ._params .copy ()
@@ -408,6 +407,7 @@ def _clone(self):
408
407
s = super ()._clone ()
409
408
410
409
s ._response_class = self ._response_class
410
+ s ._collapse = self ._collapse .copy ()
411
411
s ._sort = self ._sort [:]
412
412
s ._source = copy .copy (self ._source ) if self ._source is not None else None
413
413
s ._highlight = self ._highlight .copy ()
@@ -446,6 +446,8 @@ def update_from_dict(self, d):
446
446
self .aggs ._params = {
447
447
"aggs" : {name : A (value ) for (name , value ) in aggs .items ()}
448
448
}
449
+ if "collapse" in d :
450
+ self ._collapse = d .pop ("collapse" )
449
451
if "sort" in d :
450
452
self ._sort = d .pop ("sort" )
451
453
if "_source" in d :
Original file line number Diff line number Diff line change @@ -544,10 +544,12 @@ def test_update_from_dict():
544
544
s = search .Search ()
545
545
s .update_from_dict ({"indices_boost" : [{"important-documents" : 2 }]})
546
546
s .update_from_dict ({"_source" : ["id" , "name" ]})
547
+ s .update_from_dict ({"collapse" : {"field" : "user_id" }})
547
548
548
549
assert {
549
550
"indices_boost" : [{"important-documents" : 2 }],
550
551
"_source" : ["id" , "name" ],
552
+ "collapse" : {"field" : "user_id" },
551
553
} == s .to_dict ()
552
554
553
555
You can’t perform that action at this time.
0 commit comments