python连接Elasticsearch报错:NotFoundError HTTPOutputError: Tried to write bytes less than Content-Length
最新推荐文章于 2020-11-23 12:47:20 发布
最新推荐文章于 2020-11-23 12:47:20 发布
2019-09-30 10:26:33 [ERROR] NotFoundError:
Traceback:
"/home/wedo/screen_api/__init__.py" line 113, in _process
self.process(*args, **kwargs)
"/home/wedo/screen_api/__init__.py" line 454, in wrapper
return func(handler, *args, **kwargs)
"/home/wedo/handlers/v1/demo_query.py" line 112, in process
queryResult = query.execute()
"/home/wedo/es_engine.py" line 242, in execute
es_out = es.search(",".join(self.indexs), body=query)
"/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py" line 76, in _wrapped
return func(*args, params=params, **kwargs)
"/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py" line 636, in search
doc_type, '_search'), params=params, body=body)
"/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py" line 314, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
"/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py" line 163, in perform_request
self._raise_error(response.status, raw_data)
"/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.py" line 125, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
2019-09-30 10:26:33 [INFO] [HTTP] 500 GET /v1/demo_query?table=district&filter=pol%3D%E6%9C%88%E6%B5%A6%E9%95%87 (192.168.1.137) 196758.32ms ARGS:filter=['pol=\xe6\x9c\x88\xe6\xb5\xa6\xe9\x95\x87'], table=['district']
2019-09-30 10:26:33 [ERROR] [WEB-PLUGIN] [UNHANDLED-EXCEPTION] HTTPOutputError: Tried to write 2969 bytes less than Content-Length
Traceback:
"/home/wedo/python/tornado/web.py" line 1401, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
"/home/wedo/python/tornado/stack_context.py" line 314, in wrapped
ret = fn(*args, **kwargs)
"/home/wedo/screen_api/__init__.py" line 122, in _process
self.send_error(500, reason=msg)
"/home/wedo/python/tornado/web.py" line 978, in send_error
self.finish()
"/home/wedo/python/tornado/web.py" line 933, in finish
self.request.finish()
"/home/wedo/python/tornado/httputil.py" line 393, in finish
self.connection.finish()
"/home/wedo/python/tornado/http1connection.py" line 440, in finish
self._expected_content_remaining)
搞了好久,这里记录一下以供参考
把生成的RESTfull语句复制到Kibana
里发现是可以的,
把要查询的索引库复制到Kibana
发现也是可以的,
最后调试发现是连接Elasticsearch
的IP地址和端口号变了,
一开始的时候看到NotFoundError
还以为是因为索引库没有找到的原因呢,后来又try/catch
了一下发现还有一个报错,HTTPOutputError: Tried to write bytes less than Content-Length
因为我请求的内容和返回结果会非常非常长,看到这个错误的时候还以为自己的请求参数设置得不对呢,整了一晚上,最后发现是因为Elasticsearch的IP地址和端口号不对,
我这才想起来前天的时候同事说Elasticsearch
的配置变了,当时也没有当回事,结果今天的时候就出现了这么一档子事儿,
唉,粗心大意,不当回事啊!今天搞这么久就是这沉重的代价
python连接Elasticsearch报错:NotFoundError HTTPOutputError: Tried to write bytes less than Content-Length
问题重现Elasticsearch版本:Elasticsearch6.2.2Python版本:python2.7报错详情:2019-09-30 10:26:33 [ERROR] NotFoundError:Traceback: "/home/wedo/screen_api/__init__.py" line 113, in _process self.pro...
[]( )
自2010年以来,pyes是使用ElasticSearch的一种Python方法。
此版本需要elasticsearch 1.x或更高版本。 这是pyes 1.x的预发行版。 查看迁移文档以升级您的ElasticSearch 1.x代码。
我们正在努力提供对ElasticSearch 1.x的全面支持(请检查developer分支:我们正在使用git-flow工作流),它将具有:
基于官方ElasticSearch客户端的连接??
对ElasticSearch 1.x的完全支持(由于与旧版本的ES不兼容而删除了旧的支持)
从multi_field迁移到> field> .fields
旧代码的重
我的es数据规模为5433万,这个时候频繁执行查询、写入的操作,发现python执行有一些异常,记录下来,看看有没有解决的办法
from elasticsearch import Elasticsearch
from elasticsearch import helpers
body = {
"query": {
"range": ...
今天用jsp显示jasperReport时报如下错误:
[14:48:13.906] java.lang.IllegalStateException: http://127.0.0.1:8083/test.jsp: tried to write 1544 bytes with content-length 1439
[14:48:13.906] at com.caucho.server.co...
import json
from datetime import datetime
from elasticsearch import Elasticsearch, RequestsHttpConnection
from elasticsearch import Transport
from elasticsearch.excep...
错误完整代码:
elasticsearch.exceptions.NotFoundError: TransportError(404, 'index_not_found_exception', 'no such index')
错误分析:
电商搜索项,索引错误,检查索引配置文件,特别是settings–>HAYSTACK_CONNECTIONS–>INDEX_NAME项,索引名称有没有...
刚安装好Elasticsearch7.4.2,基本保持默认配置不变,在kibana7.4.2的DevTool中使用“PUT /test_01/_doc/1”命令时,提示index_not_found_exception错误。
这是因为Elasticsearch默认安装时禁用了自动创建索引的功能。在action.auto_create_index选项中没有配置test_...
初始化密钥库问题
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.6.0/config/elasticsearch.keystore
Like...
一、错误重现
开发中,有时候我们会遇到tomcat部署项目时,访问某个页面出现如下错误。
Attribute value view.getItems("SendAcctList") is quoted with " which must be escaped when used which must be esca
或者是Attribute value request.getParamet
错误一:TypeError: search() got an unexpected keyword argument 'doc_type',得到不预期外的参数
解决方法:elasticsearch7里不用文档类型,所以去掉doc_type='credit_data'
错误二:RequestError(400, 'illegal_argument_exception', '...
Python可以使用Elasticsearch官方提供的Python客户端库elasticsearch-py来连接Elasticsearch。首先需要安装elasticsearch-py库,可以使用pip命令进行安装:
pip install elasticsearch
安装完成后,就可以在Python代码中使用elasticsearch-py库来连接Elasticsearch了。连接Elasticsearch需要指定Elasticsearch的地址和端口号,例如:
```python
from elasticsearch import Elasticsearch
es = Elasticsearch(['http://localhost:920'])
这样就可以连接到本地的Elasticsearch实例了。连接成功后,就可以使用elasticsearch-py库提供的各种API来操作Elasticsearch了,例如:
```python
# 创建一个索引
es.indices.create(index='my_index')
# 添加一条文档
es.index(index='my_index', id=1, body={'title': 'Hello World', 'content': 'This is my first document.'})
# 搜索文档
res = es.search(index='my_index', body={'query': {'match': {'title': 'Hello'}}})
for hit in res['hits']['hits']:
print(hit['_source'])
这些API的使用方法可以参考elasticsearch-py库的官方文档。