cnpm/cnpmcore

search_phase_execution_exception

fengmk2 opened this issue · 5 comments

https://registry.npmmirror.com/-/v1/search?size=250&from=0&text=%22%40web-types%22

2023-10-12 16:20:28,085 ERROR 2048933 [-/171.36.174.100/33769c60-68d8-11ee-84f9-afc658f2b07a/15.437ms GET /-/v1/search?size=250&from=0&text=%22%40web-types%22] nodejs.ResponseError: search_phase_execution_exception
Caused by:
script_exception: compile error
Root causes:
script_exception: compile error
Caused by:
script_exception: compile error
Root causes:
script_exception: compile error
at SniffingTransport.request (/home/admin/application/node_modules/_@elastic_transport@8.3.4@@elastic/transport/src/Transport.ts:535:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Client.SearchApi [as search] (/home/admin/application/node_modules/_@elastic_elasticsearch@8.10.0@@elastic/elasticsearch/src/api/api/search.ts:89:10)
at ESSearchAdapter.search (/home/admin/application/app/infra/SearchAdapter.ts:27:20)
at SearchRepository.searchPackage (/home/admin/application/app/repository/SearchRepository.ts:38:12)
at PackageSearchService.searchPackage (/home/admin/application/app/core/service/PackageSearchService.ts:113:17)
at SearchPackageController.search (/home/admin/application/app/port/controller/package/SearchPackageController.ts:40:18)
at Object.<anonymous> (/home/admin/application/node_modules/_@eggjs_tegg-controller-plugin@3.23.0@@eggjs/tegg-controller-plugin/lib/impl/http/HTTPMethodRegister.ts:95:20)
at AlwaysAuth (/home/admin/application/app/port/middleware/AlwaysAuth.ts:13:3)

@Beace 看看这个报错?

name: "ResponseError"
meta: {"body":{"error":{"root_cause":[{"type":"script_exception","reason":"compile error","script_stack":["... ame.raw"].value.equals(""@web-types"") ? 100000 + ..."," ^---- HERE"],"script":"doc["package.name.raw"].value.equals(""@web-types"") ? 100000 + doc["downloads.all"].value : _score * Math.pow(doc["downloads.all"].value, 0.25)","lang":"painless","position":{"offset":39,"start":14,"end":64}}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"cnpmcore_packages","node":"VSOJut7lT-O451KhR1FQhA","reason":{"type":"query_shard_exception","reason":"script_score: the script could not be loaded","index_uuid":"h2fiBVTYTtOZJjS1KPgqIw","index":"cnpmcore_packages","caused_by":{"type":"script_exception","reason":"compile error","script_stack":["... ame.raw"].value.equals(""@web-types"") ? 100000 + ..."," ^---- HERE"],"script":"doc["package.name.raw"].value.equals(""@web-types"") ? 100000 + doc["downloads.all"].value : _score * Math.pow(doc["downloads.all"].value, 0.25)","lang":"painless","position":{"offset":39,"start":14,"end":64},"caused_by":{"type":"illegal_argument_exception","reason":"unexpected character [@].","caused_by":{"type":"lexer_no_viable_alt_exception","reason":"lexer_no_viable_alt_exception: null"}}}}}],"caused_by":{"type":"script_exception","reason":"compile error","script_stack":["... ame.raw"].value.equals(""@web-types"") ? 100000 + ..."," ^---- HERE"],"script":"doc["package.name.raw"].value.equals(""@web-types"") ? 100000 + doc["downloads.all"].value : _score * Math.pow(doc["downloads.all"].value, 0.25)","lang":"painless","position":{"offset":39,"start":14,"end":64},"caused_by":{"type":"illegal_argument_exception","reason":"unexpected character [@].","caused_by":{"type":"lexer_no_viable_alt_exception","reason":"lexer_no_viable_alt_exception: null"}}}},"status":400},"statusCode":400,"headers":{"x-elastic-product":"Elasticsearch","content-type":"application/json;charset=utf-8","content-length":"2014"},"meta":{"context":null,"request":{"params":{"method":"POST","path":"/cnpmcore_packages/_search","body":"{"size":"250","from":"0","query":{"function_score":{"boost_mode":"replace","query":{"bool":{"should":[{"multi_match":{"query":"\"@web-types\"","operator":"and","fields":["package.name.standard^4","package.description.standard","package.keywords.standard^2"],"type":"cross_fields","boost":6,"tie_breaker":0.5}},{"multi_match":{"query":"\"@web-types\"","operator":"and","fields":["package.name.edge_ngram^4","package.description.edge_ngram","package.keywords.edge_ngram^2"],"type":"phrase","slop":3,"boost":3,"tie_breaker":0.5}},{"multi_match":{"query":"\"@web-types\"","operator":"and","fields":["package.name.english_docs^4","package.description.english_docs","package.keywords.english_docs^2"],"type":"cross_fields","boost":3,"tie_breaker":0.5}},{"multi_match":{"query":"\"@web-types\"","operator":"and","fields":["package.name.english_aggressive_docs^4","package.description.english_aggressive_docs","package.keywords.english_aggressive_docs^2"],"type":"cross_fields","tie_breaker":0.5}}],"minimum_should_match":1}},"script_score":{"script":{"source":"doc[\"package.name.raw\"].value.equals(\"\"@web-types\"\") ? 100000 + doc[\"downloads.all\"].value : _score * Math.pow(doc[\"downloads.all\"].value, 0.25)","params":{"text":"\"@web-types\"","scoreEffect":0.25}}}}}}","querystring":"","headers":{"user-agent":"elasticsearch-js/8.10.0 (linux 5.4.0-92-generic-x64; Node.js 16.20.1; Transport 8.3.4)","x-elastic-client-meta":"es=8.10.0,js=16.20.1,t=8.3.4,hc=16.20.1","content-type":"application/vnd.elasticsearch+json; compatible-with=8","accept":"application/vnd.elasticsearch+json; compatible-with=8","content-length":"1268"}},"options":{},"id":557},"name":"elasticsearch-js","connection":

image

@Beace 还有新的报错

content: 2023-10-13 10:12:52,884 ERROR 569572 [-/127.0.0.1/03f549f0-696e-11ee-861a-b7162cccdc51/5.493ms GET /] nodejs.ResponseError: [EventBus] process event PACKAGE_UNPUBLISHED failed: {"_index":"cnpmcore_packages","_id":"mp3-do-wnload-file-to-day-43327-dreams-saturday-nights-jhdqn-dsbfko","_version":1,"result":"not_found","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":2282664,"_primary_term":1}

Beace commented

我看看

Beace commented

两个问题:查询脚本拼接有些异常case,删除时es并没这条记录导致的问题。晚些我提 PR