How to use the elasticsearch2.transport.get_host_info function in elasticsearch2

To help you get started, we’ve selected a few elasticsearch2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / elasticsearch-py / test_elasticsearch2 / test_transport.py View on Github external
def test_master_only_nodes_are_ignored(self):
        nodes = [
            {'attributes': {'data': 'false', 'client': 'true'}},
            {'attributes': {'data': 'false'}},
            {'attributes': {'data': 'false', 'master': 'true'}},
            {'attributes': {'data': 'false', 'master': 'false'}},
            {'attributes': {}},
            {}
        ]
        chosen = [ i for i, node_info in enumerate(nodes) if get_host_info(node_info, i) is not None]
        self.assertEquals([0, 3, 4, 5], chosen)