Example #1
0
def test_exclude():
    s = Search()
    s = s.exclude("match", title="python")

    assert {
        "query": {
            "bool": {
                "filter": [{
                    "bool": {
                        "must_not": [{
                            "match": {
                                "title": {
                                    "query": "python"
                                }
                            }
                        }]
                    }
                }]
            }
        }
    } == s.to_dict()
Example #2
0
    def test_exclude(self):
        s = Search()
        s = s.exclude("match", title="python")

        self.assertEqual(
            {
                "query": {
                    "bool": {
                        "filter": [{
                            "bool": {
                                "must_not": [{
                                    "match": {
                                        "title": {
                                            "query": "python"
                                        }
                                    }
                                }]
                            }
                        }]
                    }
                }
            },
            s.to_dict(),
        )