On Thu, Mar 27, 2014 at 9:45 AM, bob <[email protected]> wrote:

> select top 2 *
> from VersionMax v
> where v.ScoreDocument < 1.9
> order by v.ScoreDocument desc
>
> This last query is the one I want to translate to ES syntax :
> -top 2 => in docagg / size
> -v.ScoreDocument < 1.9 => term /range filter ?
>
> Any idea on how to do that ?
>

You should be able to do that by using a filter aggregation[1] with a
script filter[2] in order to only run the aggregation on a specific score
range.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations-bucket-filter-aggregation.html
[2]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html

-- 
Adrien Grand

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6nUMbtoTXRAHPt0cRmQyTRW_NWx0Tgvx-%3DiQmab92fdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to