from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()
doc = {
\'author\': \'kimchy\',
\'text\': \'Elasticsearch: cool.
The connection timed out problem could occur if you are using Amazon Elastic Search service.
es = Elasticsearch([{'host': 'xxxxxx.us-east-1.es.amazonaws.com', 'port': 443, 'use_ssl': True}])
The above python code where you override the default port from 9200 to 443 and setting the SSL to true will resolve the issue.
If no port is specified, it is trying to connect to the port 9200 in the specified host and fails after time out