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

Comments

Projects
None yet
4 participants
@clintongormley
Copy link
Member

commented Jul 16, 2014

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

This comment has been minimized.

Copy link
Member

commented Jul 16, 2014

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

@s1monw

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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
You can’t perform that action at this time.