ElasticPress
ElasticPress copied to clipboard
Support orderby post__in
orderby
in WP_Query supports post__in
. We should support this in EP.
I try to solve this but ES doesn't allow to sort by field, it only allow sort by asc
or desc
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_sort_order
@tlovett1 Do you have any pointers how to achieve this?
I did ask in stackoverflow, and ES doesn't have custom sort order. But we can achieve that by weighting the data: https://stackoverflow.com/questions/44226928/how-to-sort-by-field-in-elasticsearch/44227402#44227402
What is the LOE for this?
We're getting 100MB+ logs on a site we're running every day in ES logs due to lack of support here. Anything we can do to help? In the meantime, we may have to add an unmapped_type
parameter to suppress the issue.
@JustinSainton would be happy to review a PR :) Wish I had a quick fix for this one.
@felipeelia
Do we have any news regarding this Bug?
I am getting the following error:
No mapping found for [post__in]
in order to sort on
The field post__in was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
The field post__in
was not found. Make sure it is added to the list of indexed fields and run a new sync.
{
"from": 0,
"size": 9,
"post_filter": {
"bool": {
"must": [
{
"bool": {
"must": {
"terms": {
"post_id": [
130737,
130721
]
}
}
}
},
{
"terms": {
"post_type.raw": [
"product"
]
}
},
{
"term": {
"post_status": "publish"
}
}
]
}
},
"query": {
"match_all": {
"boost": 1
}
},
"_source": {
"includes": [
"post_id"
]
},
"sort": [
{
"post__in": {
"order": "desc"
}
}
]
}