api-platform / api-platform/core
[Elasticsearch] match filters - remove constant_score and allow to sort by _score
- Dominant language
- PHP
- Stars
- 2.6k
- Forks
- 980
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 51
Description
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
}
```
Contributor guide
Assessment
This issue has not been assessed yet.