api-platform / api-platform/core

[Elasticsearch] match filters - remove constant_score and allow to sort by _score

未關閉
#5,190 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Elasticsearch
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 2 小時
30 天內合併 PR
51

描述

Api Plaform shoud have config to disable automatically plugged ApiPlatform\Elasticsearch\Extension\ConstantScoreFilterExtension when using ApiPlatform\Elasticsearch\Filter\MatchFilter;

#[ApiFilter(MatchFilter::class, properties: ['name'])]

Actual Api Platform to ElasticSearch request returns nonsense results

```json
GET /product/_search
{
"query":{
"constant_score":{
"filter":{
"bool":{
"must":[
{
"match":{
"name":"PARKSIDE PERFORMANCE Multisvářečka s technologií dvojitého impulzu PMPS 200 A1"
}
}
]
}
}
}
},
"sort":[
{
"id":{
"order":"asc"
}
}
],
"size":30,
"from":0
}
```

Working solution
```json
GET /product/_search
{
"query":{
"bool":{
"must":[
{
"match":{
"name":"PARKSIDE PERFORMANCE Multisvářečka s technologií dvojitého impulzu PMPS 200 A1"
}
}
]
}
},
"sort":[
{
"_score":{
"order":"desc"
}
}
],
"size":30,
"from":0
}
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。