Fixed issue 769:Collapse not preserved when chaining a search instance (#771)
* Fixed issue 769:Collapse not preserved when chaining a search instance Signed-off-by: vatsal <[email protected]> * Fixed issue 769:Collapse not preserved when chaining a search instance Signed-off-by: vatsal <[email protected]> * Fixed issue 769:Collapse not preserved when chaining a search instance Signed-off-by: vatsal <[email protected]> * Fixed issue 769:Collapse not preserved when chaining a search instance Signed-off-by: vatsal <[email protected]> * Fixed issue 769:Collapse not preserved when chaining a search instance Signed-off-by: vatsal <[email protected]> --------- Signed-off-by: vatsal <[email protected]>
This commit is contained in:
@@ -622,3 +622,19 @@ def test_rescore_query_to_dict() -> None:
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_collapse_chaining() -> None:
|
||||
s = search.Search(index="index_name")
|
||||
s = s.filter("term", color="red")
|
||||
s = s.collapse(field="category")
|
||||
s = s.filter("term", brand="something")
|
||||
|
||||
assert {
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [{"term": {"color": "red"}}, {"term": {"brand": "something"}}]
|
||||
}
|
||||
},
|
||||
"collapse": {"field": "category"},
|
||||
} == s.to_dict()
|
||||
|
||||
Reference in New Issue
Block a user