Solved.

Over the irc channel the user @honzakral showed me a working example he had 
and I noticed that for aggregations, the size property cannot be quoted.

On the line of the previous examples, this works:

{
  "size": "1",
  "aggs": {
    "tags": {
      "terms": {
        "field": "usrIdHost",
        "size": 1
      }
    }
  }
}

Opened a ticket so this inconsistency can be checked: 
https://github.com/elasticsearch/elasticsearch/issues/6061

On Tuesday, May 6, 2014 1:34:10 PM UTC+2, Oswaldo Dantas wrote:
>
> Hello all,
>
> I've tested  with versions 1.0.0, 1.1.0 and 1.1.1 and the  size property 
> doesn't seam to work.
>
> The following works using facets:
> {
>   "size": "0",
>   "facets": {
>     "facettest": {
>       "terms": {
>         "field": "somefield",
>         "size": "5"
>       }
>     }
>   }
> }
>
> The response contains 5 terms as expected, but changing to aggregations:
>
> {
>   "size": "0",
>   "aggs": {
>     "aggtest": {
>       "terms": {
>         "field": "somefield",
>         "size": "5"
>       }
>     }
>   }
> }
>
> Return an 400 error message ending with "Parse Failure [Unknown key for a 
> VALUE_STRING in [aggtest]: [size].]]; }]".
>
> Is there any special requirement or configuration for this to work? The 
> documentation talks about this property since some time in 
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-aggregations-bucket-terms-aggregation.html#_size_amp_shard_sizebut
>  doesn't actually show an usage example.
>
> Cheers,
> Oswaldo
>

-- 
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/2b2d5945-eedc-4444-904c-fcf77e756459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to