Boost only first document matching criteria

This sounds perhaps as a non-ES use case, but I would like to have a single
document which has a certain flag boost to the top of the results.

I have ~10% of the documents with a flag. All documents (disregarding the
flag) are sorted on _timestamp. All fields have a _boost by default of 1.0.
Now I would like to keep the sort the same, except for the first
document
matching a non-null value for specified flag. In other words, the
latest (chronologically) flagged document should be the 1st result, all
other documents (with or without flag) are sorted "just" based on
_timestamp.

Is this possible with ES? I have been thinking about the ES index where I
set a _boost value of >1.0 for a flagged document and each time I insert a
new flagged document, I update all flagged documents in the index with a
boost of 1.0, effectively resetting the boost every time. But as this is
such a nasty solution, I hope ES users will help me with some more insights
:slight_smile:

--
Jurian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/787640ea-fb79-4f65-b294-34c4e21fba87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.