Example #1
0
    def test_put_script(self):
        c = BaseClient()
        body = """
        {
            "query": {
                "function_score": {
                    "query": {
                        "match": {
                             "body": "foo"
                        }
                     },
                    "functions": [
                    {
                        "script_score": {
                            "script": "calculate-score",
                            "params": {
                                "my_modifier": 8
                            }
                        }
                    }
                    ]
                }
            }
        }

        """
        h_cb = partial(
            self.handle_cb,
            **{'codes':[400, 404]}
        )
        c.put_script(
            'native',
            'testscript123',
            body,
            callback = h_cb,
        )
        self.wait()