Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregations: histo "interval" should allow coercion from string #6893

Closed
clintongormley opened this issue Jul 16, 2014 · 3 comments
Closed

Comments

@clintongormley
Copy link

This fails with Unexpected token VALUE_STRING in aggregation [histo] because "50" is passed as a string:

curl -XGET 'http://localhost:9200/_search?pretty=1' -d '
{
   "aggs" : {
      "histo" : {
         "histogram" : {
            "interval" : "50",
            "field" : "number"
         }
      }
   }
}
'

Perl won't guarantee that a number is a number and not a string.

@colings86
Copy link
Contributor

This is probably an issue for a lot of number fields in the aggregations. All will need to be checked for this

@s1monw
Copy link
Contributor

s1monw commented Jul 17, 2014

I guess we should just check for:

            } else if (token == XContentParser.Token.VALUE_NUMBER || token == XContentParser.Token.VALUE_STRING) {

@s1monw s1monw added v1.4.0 and removed v1.3.0 labels Jul 21, 2014
@kimchy
Copy link
Member

kimchy commented Jul 21, 2014

yea, or just check if token.isValue and try and get the relevant type, the parsers will automatically convert strings to number if you ask for a long value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants