def testWriteToAlias(self):
        self.assertTrue('acknowledged' in self.conn.indices.create_index(self.index_name))
        self.assertTrue('acknowledged' <= self.conn.indices.create_index("test-index2"))
        self.assertTrue('acknowledged' in self.conn.indices.set_alias("test-alias", ['test-index']))
        self.assertTrue('acknowledged' in self.conn.indices.set_alias("test-alias2", ['test-index', 'test-index2']))

        # Can write to indices.aliases only if they point to exactly one index.
        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() # ensure that the documents have been indexed.
        # Check the document counts for each index or alias.
        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/operator `in` -> `<=`