mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Use XContentParser.isBooleanValue to detect all boolean values for the _source
parameter for both _mget and _search
Closes #3981
This commit is contained in:
parent
0f8149dca4
commit
68de46ff05
@ -322,10 +322,12 @@ public class MultiGetRequest extends ActionRequest<MultiGetRequest> {
|
|||||||
} else if ("_version_type".equals(currentFieldName) || "_versionType".equals(currentFieldName) || "version_type".equals(currentFieldName) || "versionType".equals(currentFieldName)) {
|
} else if ("_version_type".equals(currentFieldName) || "_versionType".equals(currentFieldName) || "version_type".equals(currentFieldName) || "versionType".equals(currentFieldName)) {
|
||||||
versionType = VersionType.fromString(parser.text());
|
versionType = VersionType.fromString(parser.text());
|
||||||
} else if ("_source".equals(currentFieldName)) {
|
} else if ("_source".equals(currentFieldName)) {
|
||||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
if (parser.isBooleanValue()) {
|
||||||
fetchSourceContext = new FetchSourceContext(parser.booleanValue());
|
fetchSourceContext = new FetchSourceContext(parser.booleanValue());
|
||||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||||
fetchSourceContext = new FetchSourceContext(new String[]{parser.text()});
|
fetchSourceContext = new FetchSourceContext(new String[]{parser.text()});
|
||||||
|
} else {
|
||||||
|
throw new ElasticSearchParseException("illegal type for _source: [" + token + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||||
|
@ -48,7 +48,7 @@ public class FetchSourceParseElement implements SearchParseElement {
|
|||||||
List<String> includes = null, excludes = null;
|
List<String> includes = null, excludes = null;
|
||||||
String currentFieldName = null;
|
String currentFieldName = null;
|
||||||
token = parser.currentToken(); // we get it on the value
|
token = parser.currentToken(); // we get it on the value
|
||||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
if (parser.isBooleanValue()) {
|
||||||
context.fetchSourceContext(new FetchSourceContext(parser.booleanValue()));
|
context.fetchSourceContext(new FetchSourceContext(parser.booleanValue()));
|
||||||
return;
|
return;
|
||||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user