File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,10 @@ class SpanWithin(Query):
355355
356356
357357# core queries
358+ class CombinedFields (Query ):
359+ name = "combined_fields"
360+
361+
358362class Common (Query ):
359363 name = "common"
360364
Original file line number Diff line number Diff line change @@ -27,6 +27,34 @@ def test_empty_Q_is_match_all():
2727 assert query .MatchAll () == q
2828
2929
30+ def test_combined_fields_to_dict ():
31+ assert {
32+ "combined_fields" : {
33+ "query" : "this is a test" ,
34+ "fields" : ["name" , "body" , "description" ],
35+ "operator" : "and" ,
36+ },
37+ } == query .CombinedFields (
38+ query = "this is a test" ,
39+ fields = ["name" , "body" , "description" ],
40+ operator = "and" ,
41+ ).to_dict ()
42+
43+
44+ def test_combined_fields_to_dict_extra ():
45+ assert {
46+ "combined_fields" : {
47+ "query" : "this is a test" ,
48+ "fields" : ["name" , "body^2" ],
49+ "operator" : "or" ,
50+ },
51+ } == query .CombinedFields (
52+ query = "this is a test" ,
53+ fields = ["name" , "body^2" ],
54+ operator = "or" ,
55+ ).to_dict ()
56+
57+
3058def test_match_to_dict ():
3159 assert {"match" : {"f" : "value" }} == query .Match (f = "value" ).to_dict ()
3260
You can’t perform that action at this time.
0 commit comments