cnpm / cnpmcore

Private NPM Registry for Enterprise
https://npmmirror.com
MIT License
622 stars 84 forks source link

nodejs.ResponseError: x_content_parse_exception #622

Closed fengmk2 closed 11 months ago

fengmk2 commented 11 months ago
2023-12-14 11:51:46,612 ERROR 2238539 [-/124.64.200.147/1a529260-9a34-11ee-9a36-6daf70505927/45.962ms GET /-/v1/search] nodejs.ResponseError: x_content_parse_exception
Caused by:
parsing_exception: No text specified for multi_match query
Root causes:
parsing_exception: No text specified for multi_match query
Caused by:
parsing_exception: No text specified for multi_match query
Root causes:
parsing_exception: No text specified for multi_match query
at SniffingTransport.request (/home/admin/application/node_modules/_@elastic_transport@8.3.4@@elastic/transport/src/Transport.ts:535:17)
at processTicksAndRejections (node:internal/process/task_queues:95: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.27.0@@eggjs/tegg-controller-plugin/lib/impl/http/HTTPMethodRegister.ts:100:20)
at AlwaysAuth (/home/admin/application/app/port/middleware/AlwaysAuth.ts:13:3)
at Tracing (/home/admin/application/app/port/middleware/Tracing.ts:22:3)
name: "ResponseError"
meta: {"body":{"error":{"root_cause":[{"type":"parsing_exception","reason":"No text specified for multi_match query","line":1,"col":259}],"type":"x_content_parse_exception","reason":"[1:259] [bool] failed to parse field [should]","caused_by":{"type":"parsing_exception","reason":"No text specified for multi_match query","line":1,"col":259}},"status":400},"statusCode":400,"headers":{"x-elastic-product":"Elasticsearch","content-type":"application/json;charset=utf-8","content-length":"341"},"meta":{"context":null,"request":{"params":{"method":"POST","path":"/cnpmcore_packages/_search","body":"{\"query\":{\"function_score\":{\"boost_mode\":\"replace\",\"query\":{\"bool\":{\"should\":[{\"multi_match\":{\"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\":{\"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\":{\"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\":{\"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(params.text) ? 100000 + doc[\\\"downloads.all\\\"].value : _score * Math.pow(doc[\\\"downloads.all\\\"].value, params.scoreEffect)\",\"params\":{\"text\":\"\",\"scoreEffect\":0.25}}}}}}","querystring":"","headers":{"user-agent":"elasticsearch-js/8.10.0 (linux 5.4.0-164-generic-x64; Node.js 18.19.0; Transport 8.3.4)","x-elastic-client-meta":"es=8.10.0,js=18.19.0,t=8.3.4,hc=18.19.0","content-type":"application/vnd.elasticsearch+json; compatible-with=8","accept":"application/vnd.elasticsearch+json; compatible-with=8","content-length":"1137"}},"options":{},"id":24},"name":"elasticsearch-js",","headers":{},"status":"alive"},"attempts":0,"aborted":false},"warnings":null}
pid: 2238539
fengmk2 commented 11 months ago

@Beace 还是有搜索错误

Beace commented 11 months ago

应该是不传搜索关键词的报错,我到家搞下

Beace commented 11 months ago

https://github.com/cnpm/cnpmcore/pull/623