So, i'm doing sort with priority that already solved on my previous post: Elastic - Sorting value with priority
But i found the new problem, when i want to filter data with specified field, the query sort of timeInt doesn't work anymore
I've tried this query, but the query sort of timeInt doesn't work. Here is my query:
{
query: {
bool: {
must: {
match: {
'flag_type': "contract"
}
},
should: [
{
match: {
timeInt: {
query: 0,
boost: 3
}
}
},
{
match: {
timeInt: {
query: 1,
boost: 2
}
}
}
]
}
},
sort: [
{ _score: "desc"},
{
timeInt: {
order: "desc"
}
}
]
}
NOTE: If i delete the query sort: { _score: "desc" }
desc sort is working properly, but can't boost up value 0 / 1 to the top.
Expected result:
0, 1, 100, 99, 98, etc...
Current result:
If i delete { _score: "desc" }
:
100, 99, 98, 97, 96, etc...
With query above: 0, 1, 15, 99, 100, 70, 2, etc...
What's wrong with my query?
Please help me
Thank you.