def serialize(self):
data = {self._internal_name: self.query.serialize()}<EOL>if self.query_weight is not None:<EOL><INDENT>data['<STR_LIT>'] = self.query_weight<EOL><DEDENT>if self.rescore_query_weight is not None:<EOL><INDENT>data['<STR_LIT>'] = self.rescore_query_weight<EOL><DEDENT>return data<EOL>
Serialize the query to a structure using the query DSL.