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
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

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


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
To view this discussion on the web visit
For more options, visit