大佬教程收集整理的这篇文章主要介绍了获取 RequestError(400, 'search_phase_execution_exception', 'runtime error') 的相似性,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用 tensorflow_hub 通过 Elasticsearch 进行语义搜索,但我得到 requestError: requestError(400,'search_phase_execution_exception','runtime error')
。从 search_phase_execution_exception 我想数据损坏(from this stack question)我的文档结构看起来像这样
{
"setTings": {
"number_of_shards": 2,"number_of_replicas": 1
},"mapPings": {
"dynamic": "true","_source": {
"enabled": "true"
},"propertIEs": {
"ID": {
"type":"keyword"
},"title": {
"type": "text"
},"abstract": {
"type": "text"
},"abs_emb": {
"type":"dense_vector","dims":512
},"timestamp": {
"type":"date"
}
}
}
}
我使用 elasticsearch.inDices.create
创建了一个文档。
es.inDices.create(index=index,body='my_document_structure')
res = es.inDices.delete(index=index,ignore=[404])
for i in range(100):
doc = {
'timestamp': datetiR_138_11845@e.datetiR_138_11845@e.utcNow(),'ID':ID[i],'title'@R_992_6964@[0][i],'abstract':abstract[0][i],'abs_emb':tf_hub_KerasLayer([abstract[0][i]])[0]
}
res = es.index(index=index,body=doC)
对于我的语义搜索,我使用此代码
query = "石墨烯" 查询向量 = 列表(嵌入([查询])[0])
script_query = {
"script_score": {
"query": {"match_all": {}},"script": {
"source": "cosinesimilarity(params.query_vector,doc['abs_emb']) + 1.0","params": {"query_vector": query_vector}
}
}
}
response = es.search(
index=index,body={
"size": 5,"query": script_query,"_source": {"includes": ["title","abstract"]}
}
)
我知道在 stackoverflow 和 elsasticsearch 中有一些类似的问题,但我找不到适合我的解决方案。我的猜测是文档结构错误,但我无法弄清楚到底是什么。我使用了 this 存储库中的搜索查询代码。完整的错误信息太长,似乎没有包含太多信息,所以我只分享最后一部分。
~/untitled/elastic/venv/lib/python3.9/site-packages/elasticsearch/connection/base.py in
_raise_error(self,status_code,raw_data)
320 logger.warning("Undecodable raw error response from server: %s",err)
321
--> 322 raise http_EXCEPTIONs.get(status_code,TransportError)(
323 status_code,error_message,additional_info
324 )
requestError: requestError(400,'runtime error')
这里是来自 Elasticsearch 服务器的错误。
[2021-04-29T12:43:07,797][WARN ][o.e.c.r.a.diskThresholdMonitor]
[asmac.local] high disk watermark [90%] exceeded on
[w7lUacguTZWH9xc_lyd0kg][asmac.local][/Users/username/elasticsearch-
7.12.0/data/nodes/0] free: 17.2gb[7.4%],shards will be relocated
away from this node; currently relocating away shards @R_26_10586@lling [0]
bytes; the node is expected to conTinue to exceed the high disk
watermark when these reLOCATIOns are complete
我认为您正在点击 following issue,您应该将您的查询更新为:
script_query = {
"script_score": {
"query": {"match_all": {}},"script": {
"source": "cosinesimilarity(params.query_vector,'abs_emb') + 1.0","params": {"query_vector": query_vector}
}
}
}
还要确保 query_vector
contains floats and not doubles
以上是大佬教程为你收集整理的获取 RequestError(400, 'search_phase_execution_exception', 'runtime error') 的相似性全部内容,希望文章能够帮你解决获取 RequestError(400, 'search_phase_execution_exception', 'runtime error') 的相似性所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。