Holding aggregation results in parameters

Hi all - I have been trying to do the following using aggregations but have
been unable to and any help on this would be really great.

Assume that my document has two fields: A and B. I want to do the following:

  1. Get max (A)
  2. Get max (B)
  3. Take difference of #1 and #2
  4. Get the count of all documents for which the difference (computed in
    #3) is more than say 'x'

Does aggregation support execution of stuff like above where I believe I
will have to temporarily store the values in a variable and then use it in
the next filter (more like a nested query).

thoughts?
-Amit.

--
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/CAAOGaQLoT%2BKXAyFRsEiZOD_hy%3D4nf2WKB61ysO7XF5BJvQzkEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Trying to understand your question, when you say max(A) or max(B), do you
mean you have multiple values in A or B per document?

Also, it "sounds" to me like you want a script_filter instead of an
aggregation:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html

--
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/0b002205-304c-460f-b8f1-808e45658283%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Binh - Apology for the late reply. By max(A) I mean maximum value of a
field A and A can have multiple values. My document would have both field A
and field B.

-Amit.

On Mon, Mar 24, 2014 at 9:50 AM, Binh Ly binhly_es@yahoo.com wrote:

Trying to understand your question, when you say max(A) or max(B), do you
mean you have multiple values in A or B per document?

Also, it "sounds" to me like you want a script_filter instead of an
aggregation:

Elasticsearch Platform — Find real-time answers at scale | Elastic

--
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/0b002205-304c-460f-b8f1-808e45658283%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/0b002205-304c-460f-b8f1-808e45658283%40googlegroups.com?utm_medium=email&utm_source=footer
.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAOGaQJW3PTDEuApiZiW%2BoQjjvj2NQx1BNo%2BJsfmvxX5bxE%3DXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.