I suppose you can make a bucket for each value of _id that matches your query; you should then have one bucket per document, on which you can define sub-aggregations (only metrics at this granularity) -- but really at that point, script_fields would be equivalent.
It sounds like you want to get aggregations at the global scope based on values from documents that match a certain query. This is not possible -- you will have to do multiple queries. On Wednesday, September 10, 2014 9:34:13 AM UTC-4, Mindaugas Verdingovas wrote: > > In other words can you create a bucket for each document in your query and > then add some further aggregations using values of that document. > > I also asked for the same question in detail on stack overflow here is a > link if you need more details to the question > http://stackoverflow.com/questions/25720027/elasticsearch-aggregations-is-it-possible-to-reference-filter-query-data-in-agg > > <http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F25720027%2Felasticsearch-aggregations-is-it-possible-to-reference-filter-query-data-in-agg&sa=D&sntz=1&usg=AFQjCNFEo1k9QKsXZnIGCjBJUx01aHkbeA> > > if you don't understand something please ask me I'll try my best to > explain. > > if it's not possible could someone just tell me that, because I've spend a > lot of hours trying to find a way of achieving this without any luck. > > or maybe you have some other ideas on how I should represent my data to > meet my demands? > -- 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/28ca3e77-cbc0-4f37-9d6b-16e1cf776309%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
