Creating an ILM policy using python

I have been trying to create an ILM policy using the python client. But I get an error when running the python script.

This is my code:

from datetime import datetime
from elasticsearch import Elasticsearch
from elasticsearch.Elasticsearch.client import ILMClient

es = Elasticsearch()
es_ilm = IlmClient(es)
**---- more lines of code ----**

But I get the following error:

Traceback (most recent call last):
  File "C:\elasticsearchpython\datastreamilm\", line 3, in <module>
    from elasticsearch.Elasticsearch.client import ILMClient
ModuleNotFoundError: No module named 'elasticsearch.Elasticsearch'

How do you import the ILMClient into the python script? Also, do I need to download and install anything other than the Elasticsearch module?


Which client version are you using?

I'm not super familiar with python but don't you have a typo between IlmClient and ILMClient.

thank you so much. that was the mistake.