kadnan / python-elasticsearch Goto Github PK
View Code? Open in Web Editor NEWAn example program that scrapes data from AllRecipes.com and store in Elasticsearch
License: MIT License
An example program that scrapes data from AllRecipes.com and store in Elasticsearch
License: MIT License
`(env) Divyanshu-MacBook-Air-1133:~ divyanshu$ python /Users/divyanshu/elasticsearch_python/example.py
Awww it could not connect!
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb95d7fd0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb95d7fd0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba71b810>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba71b810>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba531890>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba531890>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba5315d0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba5315d0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebb342f10>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebb342f10>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba1851d0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba1851d0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebaaba9d0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebaaba9d0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb9656a50>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb9656a50>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba2b7690>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba2b7690>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebb073310>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebb073310>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebaa07dd0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8ebaa07dd0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb9780e50>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb9780e50>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba5d9850>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba5d9850>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba4f2150>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba4f2150>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb961ae50>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb961ae50>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba9cf490>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba9cf490>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba18d210>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba18d210>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb960abd0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb960abd0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba1199d0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba1199d0>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb970ae50>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb970ae50>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba119890>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba119890>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994fe90>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994fe90>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994fb10>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994fb10>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994f990>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb994f990>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba0e6c90>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba0e6c90>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba0e6850>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba0e6850>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba22fb90>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba22fb90>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb985dc90>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb985dc90>: Failed to establish a new connection: [Errno 61] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb985d3d0>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eb985d3d0>: Failed to establish a new connection: [Errno 61] Connection refused)
Awww it could not connect!
Traceback (most recent call last):
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/divyanshu/env/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 229, in perform_request
method, url, body, retries=Retry(False), headers=request_headers, **kw
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/util/retry.py", line 376, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/Users/divyanshu/env/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f8eba725d50>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/divyanshu/elasticsearch_python/example.py", line 166, in
search(es, 'recipes', json.dumps(search_object))
File "/Users/divyanshu/elasticsearch_python/example.py", line 11, in search
res = es_object.search(index=index_name, body=search)
File "/Users/divyanshu/env/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 92, in _wrapped
return func(*args, params=params, headers=headers, **kwargs)
File "/Users/divyanshu/env/lib/python3.7/site-packages/elasticsearch/client/init.py", line 1623, in search
body=body,
File "/Users/divyanshu/env/lib/python3.7/site-packages/elasticsearch/transport.py", line 362, in perform_request
timeout=timeout,
File "/Users/divyanshu/env/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 241, in perform_request
raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba725d50>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f8eba725d50>: Failed to establish a new connection: [Errno 61] Connection refused)`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.