This is a repeat of an earlier request but with a lot more information.
I have installed elasticsearch 6.5.3 on an aws ec2 server. Inbound rules are:
SSH TCP 0.0.0.0 PORTS RANGE 22
HTTP: TCP 0.0.0.0 PORTS RANGE 80
HTTPS TCP 0.0.0.0 PORTS RANGE 443
In the /etc/elasticsearch/elasticsearch.yml file the netwokr.host is as follows:
network.host: 0.0.0.0
otherwise the file has not been changed.
The Python file is:
from elasticsearch import Elasticsearch
application = Flask(__name__)
es = Elasticsearch([{'host': 'http://ec2-54-145-137-99.compute-1.amazonaws.com', 'port': 9200, 'use_ssl': False}])
@application.route('/', methods=['GET', 'POST'])
def index():
es.indices.create(index='my-index', ignore=400)
print(es.cluster.health())
if __name__ == '__main__':
application.debug = True
application.run()
I have tried multiple configurations in the elasticsearch.yml file in /etc/elasticsearch/ including:
network.host: 0.0.0.0 (current configuration)
network.host: my ec2 ip address
network.host: 127.0.0.1
network.host: full ec2 DNS
I have also tried multiple configurations in the application.py file including:
es = Elasticsearch("http://54.145.137.99")
es = Elasticsearch()
es = Elasticsearch([{'host': 'https://ec2-54-145-137-99.compute-1.amazonaws.com', 'port': 443, 'use_ssl': True}])
es = Elasticsearch([{'host': 'http://ec2-54-145-137-99.compute-1.amazonaws.com', 'port': 9200, 'use_ssl': False}]) (current)
The error message has variously been
connection timed out or connection refused
This must be something that a huge number of peole do successfully but I cannto find a solution anywhere. I have googled many, many times and I have seen threads describign the problem but no solution.
Can somebody please help me? It's extremely frustrating! Thank you.