各位们,今天发现es连不上为什么?
```python
from elasticsearch import Elasticsearch
es = Elasticsearch('http://localhost:9200')
es.indices.create(index='new', ignore=400)
报错
C:\Users\13802\AppData\Local\Programs\Python\Python312\python.exe "C:\Users\13802\Desktop\python_crawler\Python crawler\es.py"
C:\Users\13802\Desktop\python_crawler\Python crawler\es.py:4: DeprecationWarning: Passing transport options in the API method is deprecated. Use 'Elasticsearch.options()' instead.
es.indices.create(index='new', ignore=400)
Traceback (most recent call last):
File "C:\Users\13802\Desktop\python_crawler\Python crawler\es.py", line 4, in <module>
es.indices.create(index='new', ignore=400)
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elasticsearch\_sync\client\utils.py", line 446, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elasticsearch\_sync\client\indices.py", line 553, in create
return self.perform_request( # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elasticsearch\_sync\client\_base.py", line 423, in perform_request
return self._client.perform_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elasticsearch\_sync\client\_base.py", line 271, in perform_request
response = self._perform_request(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elasticsearch\_sync\client\_base.py", line 316, in _perform_request
meta, resp_body = self.transport.perform_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elastic_transport\_transport.py", line 342, in perform_request
resp = node.perform_request(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13802\AppData\Local\Programs\Python\Python312\Lib\site-packages\elastic_transport\_node\_http_urllib3.py", line 202, in perform_request
raise err from None
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))))
进程已结束,退出代码为 1
```