...
Click the User API Keys tab. Click Create.
Give the key a meaningful name.
Set an expiration date. Elastic will be constantly polling with this key, so setting a date far into the future is recommended.
Click Save & Close.
A popup will appear. Click Copy to copy your API key to your clipboard. Copy it somewhere you can easily access and copy from later, such as Notepad. This will be the key you copy into the Python script later.
...