I understood what you want. I did not understand what you did. >From what I read, your query sounds good to me.
As it does not work for you, I think you should provide a full example which reproduces your issue: http://www.elasticsearch.org/help/ <http://www.elasticsearch.org/help/> -- David Pilato | Technical Advocate | Elasticsearch.com @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr <https://twitter.com/elasticsearchfr> | @scrutmydocs <https://twitter.com/scrutmydocs> > Le 8 déc. 2014 à 18:22, Mengjiqi Fisnik <[email protected]> a > écrit : > > > Thank you David, I try to explain better. > > http://localhost/ctweets/tweet/_search > > Query: Define average age of users that have name ''Fisnik". > > I tried query that i write above but it does not calculated average age of > users with name "Fisnik". > Shows me all users with name :Fisnik", but in "Aggregations" in avg shows > value=0; > > I > > > > On Monday, December 8, 2014 4:22:13 AM UTC+1, David Pilato wrote: > May be a full SENSE example as a GIST would help understand what you are > doing? > Age is a String? > > David > > Le 8 déc. 2014 à 02:00, Mengjiqi Fisnik <[email protected] > <javascript:>> a écrit : > >> Define average age of the users with name "Jone" >> >> { >> >> "query" : { >> "match" : { "name" : "Jone" } >> }, >> >> >> "aggs" : { >> "avg_age" : { "avg" : { "field" : "age" } } >> } >> >> } >> >> This request hits all item with names Jone, but do not calculate average. >> Aggregation avg display 0. >> >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elasticsearch/46076a0f-daf1-4373-8f3f-94d67dc82d53%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elasticsearch/46076a0f-daf1-4373-8f3f-94d67dc82d53%40googlegroups.com?utm_medium=email&utm_source=footer>. >> For more options, visit https://groups.google.com/d/optout >> <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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/4cec7460-337f-4eb7-9d08-4ac19f96ac19%40googlegroups.com > > <https://groups.google.com/d/msgid/elasticsearch/4cec7460-337f-4eb7-9d08-4ac19f96ac19%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <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/126C4835-9848-4196-BDDF-B4C527CBAAF3%40pilato.fr. For more options, visit https://groups.google.com/d/optout.
