Hello,

You should be able to filter with a script using the script filter:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html

Cédric Hourcade
[email protected]


On Wed, Jun 25, 2014 at 4:36 AM, Brian Behling <[email protected]> wrote:
> I'm trying to calculate a value for each hit then select or filter on a
> calculated value. Something like below:
>
>     "query": {
>         "match_all": {}
>         },
>         "script_fields" : {
>             "counter" : {
>                 "script" : "count++",
>                 "params" : {
>                     "count"  : 1
>                 }
>             },
>             "source" : {
>               "script" : "_source"
>         }
>       }
>
> I'd like to filter on the count parameter.
>
> I've read on a StackOverflow post that you cannot filter on a script value.
>
> So is there another way to calculate some value dynamically and filter on
> that value?
>
> If not, is there a nested SQL SELECT equivalent in ElasticSearch? Maybe I
> could execute the first query to calculate the 'count' then execute another
> query to filter by a value?
>
> --
> 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/8206ea84-b314-4b8e-8f3c-248d9f5a99e7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAJQxjPPE0dAt%2BoZr%3Dev9SpDwy-04fkWX3xdAmsLcXEL%3D6i6fRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to