Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Aggregations: More lenient type parsing in histo/cardinality aggs #6948

Closed
wants to merge 1 commit into from

4 participants

@kimchy
Owner

closes #6893

@clintongormley clintongormley commented on the diff
...ch/aggregations/bucket/histogram/HistogramParser.java
@@ -65,16 +65,12 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
currentFieldName = parser.currentName();
} else if (vsParser.token(currentFieldName, token, parser)) {
continue;
- } else if (token == XContentParser.Token.VALUE_NUMBER) {
+ } else if (token.isValue()) {
if ("interval".equals(currentFieldName)) {
interval = parser.longValue();
@clintongormley Owner

To coerce, should be:

parser.longValue(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@clintongormley clintongormley commented on the diff
...gregations/metrics/cardinality/CardinalityParser.java
((6 lines not shown))
if ("rehash".equals(currentFieldName)) {
rehash = parser.booleanValue();
- } else {
- throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
- }
- } else if (token == XContentParser.Token.VALUE_NUMBER) {
- if (PRECISION_THRESHOLD.match(currentFieldName)) {
+ } else if (PRECISION_THRESHOLD.match(currentFieldName)) {
precisionThreshold = parser.longValue();
@clintongormley Owner

same here:

 parser.longValue(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@kimchy
Owner

@clintongormley the default is to coarse....

@clintongormley

Ok - right - just checked the code. never mind me :)

@martijnvg
Owner

LGTM

@kimchy kimchy closed this in 8dca4b7
@kimchy kimchy deleted the branch
@jpountz jpountz removed the review label
@lindstromhenrik lindstromhenrik referenced this pull request from a commit in episerver/elasticsearch
@kimchy kimchy More lenient type parsing in histo/cardinality aggs
closes #6948
closes #6893
51fc784
@clintongormley clintongormley changed the title from More lenient type parsing in histo/cardinality aggs to Aggregations: More lenient type parsing in histo/cardinality aggs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 21, 2014
  1. @kimchy
This page is out of date. Refresh to see the latest.
View
8 src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramParser.java
@@ -65,16 +65,12 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
currentFieldName = parser.currentName();
} else if (vsParser.token(currentFieldName, token, parser)) {
continue;
- } else if (token == XContentParser.Token.VALUE_NUMBER) {
+ } else if (token.isValue()) {
if ("interval".equals(currentFieldName)) {
interval = parser.longValue();
@clintongormley Owner

To coerce, should be:

parser.longValue(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
} else if ("min_doc_count".equals(currentFieldName) || "minDocCount".equals(currentFieldName)) {
minDocCount = parser.longValue();
- } else {
- throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: [" + currentFieldName + "].");
- }
- } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
- if ("keyed".equals(currentFieldName)) {
+ } else if ("keyed".equals(currentFieldName)) {
keyed = parser.booleanValue();
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: [" + currentFieldName + "].");
View
8 src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityParser.java
@@ -56,14 +56,10 @@ public AggregatorFactory parse(String name, XContentParser parser, SearchContext
currentFieldName = parser.currentName();
} else if (vsParser.token(currentFieldName, token, parser)) {
continue;
- } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
+ } else if (token.isValue()) {
if ("rehash".equals(currentFieldName)) {
rehash = parser.booleanValue();
- } else {
- throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
- }
- } else if (token == XContentParser.Token.VALUE_NUMBER) {
- if (PRECISION_THRESHOLD.match(currentFieldName)) {
+ } else if (PRECISION_THRESHOLD.match(currentFieldName)) {
precisionThreshold = parser.longValue();
@clintongormley Owner

same here:

 parser.longValue(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
Something went wrong with that request. Please try again.