def test_index_compiler(self): cluster = Cluster(self.client, compiler=Compiler20()) index = Index(cluster, 'test') self.assert_expression( index.search_query(index.user.name == 'kimchy').filter(index.user.status == 0), { "query": { "bool": { "must": { "term": {"name": "kimchy"} }, "filter": { "term": {"status": 0} } } } } )
def test_index_compiler(self): cluster = Cluster(self.client, compiler=Compiler20()) index = Index(cluster, 'test') self.assert_expression( index.search_query(index.user.name == 'kimchy').filter( index.user.status == 0), { "query": { "bool": { "must": { "term": { "name": "kimchy" } }, "filter": { "term": { "status": 0 } } } } })
def index(cluster): yield Index(cluster, 'test')
def setUp(self): self.client = MagicMock() self.cluster = Cluster(self.client, compiler=DefaultCompiler) self.index = Index(self.cluster, 'test')
def setUp(self): self.client = MagicMock() self.cluster = Cluster(self.client) self.index = Index(self.cluster, 'test')