mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
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;
|
Query query = null;
|
||||||
String currentFieldName = 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) {
|
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||||
if (token == XContentParser.Token.FIELD_NAME) {
|
if (token == XContentParser.Token.FIELD_NAME) {
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||||
if ("query".equals(currentFieldName)) {
|
if ("query".equals(currentFieldName)) {
|
||||||
query = queryParserService.parse(parser).query();
|
query = queryParserService.parse(parser).query();
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
parser.skipChildren();
|
||||||
}
|
}
|
||||||
|
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||||
|
parser.skipChildren();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user