Can we create the grok rules and index programatically by using PythonClient

Hi Team,

Can anyone please let me know, how to create the grok rules and index programatically by using PythonClient …

Python client - OpenSearch documentation – by using this code i was able to create the simple index but the same i need to do by creating the grok rules…

Please point me to any reference code…

Thanks,
Hema