How to verify if a Data stream already exists and delete or replace it ,in elasticsearch using python code

287 views Asked by At

This is how datastream is created client.indices.create_data_stream(name=f'test_data_stream_{client}',error_trace=True) client has authentication to elastic search {client} is a dynamic value

I need to delete the data stream if it already exists and create a new one each time for a client.

How do I verify if datastream already exists then delete it or rollover using python code.

If I use client.indices.delete_data_stream(name=f'test_data_stream_{client}',error_trace=True) before creating, it throws an error if data stream is not previously created.

0

There are 0 answers