

def testWriteToAlias(self):
    self.assertTrue(('acknowledged' in self.conn.indices.create_index(self.index_name)))
    self.assertTrue(('acknowledged' in self.conn.indices.create_index('test-index2')))
    self.assertTrue(('acknowledged' in self.conn.indices.set_alias('test-alias', ['test-index'])))
    self.assertTrue(('acknowledged' in result.conn.indices.set_alias('test-alias2', ['test-index', 'test-index2'])))
    self.conn.index(dict(title='doc1'), 'test-index', 'testtype')
    self.conn.index(dict(title='doc1'), 'test-index2', 'testtype')
    self.conn.index(dict(title='doc1'), 'test-alias', 'testtype')
    self.checkRaises(exceptions.ElasticSearchIllegalArgumentException, self.conn.index, dict(title='doc1'), 'test-alias2', 'testtype')
    self.conn.indices.refresh()
    result = self.conn.indices.get_indices(include_aliases=True)
    self.assertEqual(result['test-index'], {
        'num_docs': 2,
    })
    self.assertEqual(result['test-index2'], {
        'num_docs': 1,
    })
    self.assertEqual(result['test-alias'], {
        'alias_for': ['test-index'],
        'num_docs': 2,
    })
    self.assertEqual(result['test-alias2'], {
        'alias_for': ['test-index', 'test-index2'],
        'num_docs': 3,
    })

dataset/ETHPy150Open aparo/pyes/tests/test_aliases.py ErrorReportingTestCase.testWriteToAlias/VarMisuse@83/120 `self`->`result`