Sorry to keep on with this, but if I do that I get an error:

Parse Failure [Found two aggregation type definitions in 
[field1_top_terms]: [terms] and [field1_count]. Only one type is allowed.]

If I take the 'field1_count' from inside 'field1_top_terms' like this:

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

I get the two independent aggregations.

Thanks again for you patience...
Jose.

On Friday, 2 May 2014 16:28:08 UTC+1, Adrien Grand wrote:
>
> 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 
> <argan...@gmail.com<javascript:>
> > 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 elasticsearc...@googlegroups.com <javascript:>.
>> 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/2d1225aa-827a-4ae7-8f39-0edd0f8b7f18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to