File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,11 @@ class Script(Query):
499499 name = "script"
500500
501501
502+ class ScriptScore (Query ):
503+ name = "script_score"
504+ _param_defs = {"query" : {"type" : "query" }}
505+
506+
502507class Type (Query ):
503508 name = "type"
504509
Original file line number Diff line number Diff line change @@ -538,3 +538,18 @@ def test_function_score_from_dict():
538538 assert isinstance (sf , function .BoostFactor )
539539 assert 6 == sf .value
540540 assert {"boost_factor" : 6 } == sf .to_dict ()
541+
542+
543+ def test_script_score ():
544+ d = {
545+ "script_score" : {
546+ "query" : {"match_all" : {}},
547+ "script" : {"source" : "..." , "params" : {}},
548+ }
549+ }
550+ q = query .Q (d )
551+
552+ assert isinstance (q , query .ScriptScore )
553+ assert isinstance (q .query , query .MatchAll )
554+ assert q .script == {"source" : "..." , "params" : {}}
555+ assert q .to_dict () == d
You can’t perform that action at this time.
0 commit comments