Your aggregation has no name, and unfortunately this causes undefined
behavior because the parsing is too lenient in 1.1 and previous versions
(will be fixed in 1.2.0). Please try the following request:

GET /summary/row/_search
{
  "query": {
    "match": {
      "field3": 1
    }
  },
  "aggs": {
    "field1_top_terms": {
      "terms": {
        "field": "field1"
      },
      "field1_count": {
        "sum": {
          "field": "count"
        }
      }
    }
  }
}



On Fri, May 2, 2014 at 5:22 PM, Jose A. Garcia <arganto...@gmail.com> wrote:

> Sorry, I think I must be misunderstanding something, if I do:
>
> GET /summary/row/_search
> {
>   "query": {
>     "match": {
>       "field3": 1
>     }
>   },
>   "aggs": {
>     "terms": {
>       "field": "field1"
>     },
>     "field1_count": {
>       "sum": {
>         "field": "count"
>       }
>     }
>   }
> }
>
> I just get this in the response:
>
> "aggregations": {
>       "file1_count": {
>          "value": 75000
>       }
>    }
>
> It's just ignoring all the values of 'file1' and adding all the sizes from
> the response. Am I doing something wrong?
>
> Thanks,
> Jose.
>
> On Friday, 2 May 2014 15:55:50 UTC+1, Adrien Grand wrote:
>
>> On Fri, May 2, 2014 at 4:47 PM, Jose A. Garcia <argan...@gmail.com>wrote:
>>
>>> That's closer but I would get all the possible values and counts for
>>> 'fieldA' and the total sum of 'size' for my result set, but I need the sum
>>> of sizes for each value of 'fieldA', so it's a combination of both terms
>>> and sum, but none seems to give me exactly what I need...
>>>
>>
>> This should work: The sum aggregation is _under_ the terms aggregation,
>> so sums would be computed for each unique value of 'fieldA'.
>>
>> --
>> Adrien Grand
>>
>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/3e7e30bd-2482-4c99-9643-679adef5610d%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/3e7e30bd-2482-4c99-9643-679adef5610d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adrien Grand

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5R_aTb7i%2Buz0GfystfHOxdhApU3Y6gB55eTNGBXzLAkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to