I have product id list in terms query. I like to get result in same order as provide ids in terms query. Below is my query.
{
"size": 24,
"from": 0,
"sort": [],
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['image_src.keyword'].size()!=0",
"lang": "painless"
}
}
},
"must": [
{
"term": {
"product_to_show": {
"value": "1"
}
}
},
{
"terms": {
"product_id": [
66421,
66418,
66410,
66404
]
}
},
{
"terms": {
"is_plus": [
0,
2
]
}
},
{
"script": {
"script": "doc['gender.keyword'].value == 'f'"
}
}
]
}
}
}
should return result in same order 66421,66418,66410,66404 but query return in following order 66418, 66421, 66404, 66410.
thanks is Advance