Ejemplo n.º 1
0
 def get_read_and_write_indices(cls):
     """Gets the indices currently referenced by the read and write aliases."""
     read_indices, write_indices = get_indices_for_aliases(
         cls.get_read_alias(),
         cls.get_write_alias(),
     )
     return read_indices, _get_write_index(write_indices)
def test_get_indices_for_aliases(mock_es_client, aliases, response, result):
    """Test get_indices_for_aliases()."""
    client = mock_es_client.return_value
    client.indices.get_alias.return_value = response
    assert elasticsearch.get_indices_for_aliases(*aliases) == result
Ejemplo n.º 3
0
 def get_write_index(cls):
     """Gets the index currently referenced by the write alias."""
     indices, = get_indices_for_aliases(cls.get_write_alias())
     return _get_write_index(indices)