比方说我有10种特色产品,其余都是非特色产品
我想将每页的特色产品限制为仅显示4
所以结果会像
Page 1: 12 product - 4 featured and 8 non featured
Page 2: 12 product - 4 featured and 8 non featured
Page 3: 12 product - 2 featured and 8 non featured
无论如何,elasticsearch可以做到这一点吗?
这是我当前的查询
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"should": [
{ "term": { "featured": { "value": true, "boost": 2 } } }
// I want to only show 4 featured products per page
]
}
},
"size":12,
"from":0
}
谢谢