Registering a percolate query with additional "object" level metadata can fail, closes #1505.
This commit is contained in:
parent
32f1edf6f7
commit
4be7866bd9
|
@ -232,14 +232,22 @@ public class PercolatorExecutor extends AbstractIndexComponent {
|
|||
}
|
||||
Query query = null;
|
||||
String currentFieldName = null;
|
||||
XContentParser.Token token;
|
||||
XContentParser.Token token = parser.nextToken(); // move the START_OBJECT
|
||||
if (token != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticSearchException("Failed to add query [" + name + "], not starting with OBJECT");
|
||||
}
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if ("query".equals(currentFieldName)) {
|
||||
query = queryParserService.parse(parser).query();
|
||||
break;
|
||||
} else {
|
||||
parser.skipChildren();
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
parser.skipChildren();
|
||||
}
|
||||
}
|
||||
return query;
|
||||
|
|
Loading…
Reference in New Issue