Hi David,

Thank you for your answer.

Still, I think this should be added in documentation.
>

Absolutely agree.

I would like to contribute, but how?


On Monday, September 22, 2014 8:54:47 PM UTC+3, David Pilato wrote:
>
> Indeed. For now, the way your field is indexed looks like this:
>
> Value, Doc ID
> 6, 1
> 5, 1
> 3, 1
>
> (I simplify a lot)
>
> So, when we do the sum, we only sum different values (I mean within the 
> same document).
>
> The only workaround I can see here is to detect a index time that you have 
> some identical values and instead of indexing 
>
> ["6","5","6","3"]
>
>
> Index in another field deduplicated values:
>
> ["12","5","3"]
>
>
> Doc1: {name:"kimchy",
>  exam_note:6
> }
>
> Doc2: {name:"kimchy",
>  exam_note:5
> }
>
> Doc3: {name:"kimchy",
>  exam_note:6
> }
>
> Doc4: {name:"kimchy",
>  exam_note:3
> }
>
>
>
> It will give you the expected result.
>
>
> Still, I think this should be added in documentation. Wanna contribute?
>
>
> -- 
> *David Pilato* | Technical Advocate | *elasticsearch.com 
> <http://elasticsearch.com>*
> [email protected] <javascript:>
> @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr 
> <https://twitter.com/elasticsearchfr> | @scrutmydocs 
> <http://twitter.com/scrutmydocs>
> <https://twitter.com/scrutmydocs>
>
>
>
> Le 22 septembre 2014 à 18:58:23, Terra Sacer ([email protected] 
> <javascript:>) a écrit:
>
> Hi guys. 
>
> I've been trials for metric aggregation. I noticed something 
> interesting. Elasticsearch does not compute repeated values in the metric 
> aggregation.
>
> For example, as my documents
>
>
>  {name:"kimchy",
>  exam_notes:["6","5","6","3"]
> }
>  
> When I run the metric aggregation, the result is as follows.
>  
>   GET mytest/test/_search
> {
>   "size": 0,
>   "query": {
>     "match_all": {}
>   }, 
>   "aggs": {
>     "sum_exam_notes": {
>       "sum": {
>         "field": "exam_notes"
>       }
>     }
>   }
> }
>  
>   "aggregations": {
>    "sum_exam_notes": {
>       "value": 14
>    }
> }
>  
>
> 6 + 5 + 6 + 3 instead of 6 + 5 + 3 
>
> Why?
>
>
>  --
> 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/43261e05-aaee-48e8-9e2a-d1ce8abf7904%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elasticsearch/43261e05-aaee-48e8-9e2a-d1ce8abf7904%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ae73f864-480b-4847-87f1-85ed4641d854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to