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

Fix wrong use of currentFieldName outside of a parsing loop #10307

Merged
merged 1 commit into from Mar 30, 2015

Conversation

Projects
None yet
3 participants
@obourgain
Contributor

obourgain commented Mar 29, 2015

Parsing a multipercolate request copies the content of the JSON to a Map and then iterates on the entrySet, but for the fields ignore_unavailable, allow_no_indices and expand_wildcards it is still using the currentFieldName variable and not entry.getKey().
This cause the parsing to fail if the last fieldName of the JSON was one of these fields.

example :

curl -XPOST "http://localhost:9200/twitter/_mpercolate" -d'
{"percolate":{"index":"the_index","type":"the_type", "realtime": true,"expand_wildcards":"open"}}

will fail with error :

{
   "error": "ElasticsearchIllegalArgumentException[No valid expand wildcard value [true]]",
   "status": 400
}

This PR fixes the parsing and also extracts the parsing to a map to a dedicated method to avoid having the parsing vars wrongly reused in the future.

@jpountz

This comment has been minimized.

Show comment
Hide comment
@jpountz

jpountz Mar 29, 2015

Contributor

The fix looks good. Thanks for extracting the parsing logic to another method in order to make sure we don't make the same mistake again if we add a new parameter! Will merge soon.

Contributor

jpountz commented Mar 29, 2015

The fix looks good. Thanks for extracting the parsing logic to another method in order to make sure we don't make the same mistake again if we add a new parameter! Will merge soon.

jpountz added a commit that referenced this pull request Mar 30, 2015

Merge pull request #10307 from obourgain/fix_parsing_multipercolate
Fix wrong use of currentFieldName outside of a parsing loop.

Close #10307

@jpountz jpountz merged commit 80fe8d1 into elastic:master Mar 30, 2015

1 check passed

CLA Commit author has signed the CLA
Details

@clintongormley clintongormley changed the title from fix wrong use of currentFieldName outside of a parsing loop to Fix wrong use of currentFieldName outside of a parsing loop Jun 8, 2015

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