Created
April 22, 2023 17:11
-
-
Save zeitounator/7c5f30b86c0527bf1be3de90fb3ca060 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat testes.py | |
from elasticsearch import Elasticsearch, helpers | |
es = Elasticsearch( | |
['http://localhost:9200'], | |
basic_auth=('elastic', 'my_pass') | |
) | |
print(es.ping()) | |
print(es.info()) | |
$ docker run -d -p 9200:9200 --name my_es -e "discovery.type=single-node" -e "xpack.security.enabled=true" -e "ELASTIC_PASSWORD=my_pass" docker.elastic.co/elasticsearch/elasticsearch:8.5.0 | |
99522c891548a6f5b0ca79bd34a90f94f1e759fedc5240ad0787d1741c10e57a | |
$ echo make sure es is started | |
make sure es is started | |
$ sleep 10 | |
$ python testes.py | |
True | |
{'name': '99522c891548', 'cluster_name': 'docker-cluster', 'cluster_uuid': 'lH1lEUFYQ-qoPM60ITj3Fg', 'version': {'number': '8.5.0', 'build_flavor': 'default', 'build_type': 'docker', 'build_hash': 'c94b4700cda13820dad5aa74fae6db185ca5c304', 'build_date': '2022-10-24T16:54:16.433628434Z', 'build_snapshot': False, 'lucene_version': '9.4.1', 'minimum_wire_compatibility_version': '7.17.0', 'minimum_index_compatibility_version': '7.0.0'}, 'tagline': 'You Know, for Search'} | |
$ docker rm -f my_es | |
my_es |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment