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

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

Merged
merged 1 commit into from Mar 30, 2015

Conversation

obourgain
Copy link
Contributor

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
Copy link
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
Fix wrong use of currentFieldName outside of a parsing loop.

Close #10307
@jpountz jpountz merged commit 80fe8d1 into elastic:master Mar 30, 2015
@clintongormley clintongormley added the :Search/Percolator Reverse search: find queries that match a document label Apr 9, 2015
@clintongormley clintongormley changed the title fix wrong use of currentFieldName outside of a parsing loop 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
Labels
>bug :Search/Percolator Reverse search: find queries that match a document v1.5.1 v1.6.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants