mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
remove ParseFieldMatcher usages from Script parsing code
Original commit: elastic/x-pack-elasticsearch@4be5f83084
This commit is contained in:
parent
f71733ec4d
commit
80dc895450
@ -6,7 +6,6 @@
|
||||
package org.elasticsearch.xpack.common.text;
|
||||
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
@ -113,7 +112,7 @@ public class TextTemplate implements ToXContent {
|
||||
if (parser.currentToken() == XContentParser.Token.VALUE_STRING) {
|
||||
return new TextTemplate(parser.text());
|
||||
} else {
|
||||
return new TextTemplate(Script.parse(parser, ParseFieldMatcher.STRICT, Script.DEFAULT_TEMPLATE_LANG));
|
||||
return new TextTemplate(Script.parse(parser, Script.DEFAULT_TEMPLATE_LANG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import org.elasticsearch.action.ActionRequestBuilder;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.FilterClient;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
@ -303,7 +302,7 @@ public class SecurityIndexSearcherWrapper extends IndexSearcherWrapper {
|
||||
if (token != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticsearchParseException("Unexpected token [" + token + "]");
|
||||
}
|
||||
Script script = Script.parse(parser, ParseFieldMatcher.EMPTY);
|
||||
Script script = Script.parse(parser);
|
||||
// Add the user details to the params
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (script.getParams() != null) {
|
||||
|
@ -6,7 +6,6 @@
|
||||
package org.elasticsearch.xpack.watcher.condition;
|
||||
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
@ -55,7 +54,7 @@ public final class ScriptCondition extends Condition {
|
||||
|
||||
public static ScriptCondition parse(ScriptService scriptService, String watchId, XContentParser parser) throws IOException {
|
||||
try {
|
||||
Script script = Script.parse(parser, ParseFieldMatcher.STRICT);
|
||||
Script script = Script.parse(parser);
|
||||
return new ScriptCondition(script, scriptService);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] condition for watch [{}]. failed to parse script", pe, TYPE,
|
||||
|
@ -10,7 +10,6 @@ import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
@ -247,7 +246,7 @@ public class WatcherSearchTemplateRequest implements ToXContent {
|
||||
indicesOptions = IndicesOptions.fromOptions(ignoreUnavailable, allowNoIndices, expandOpen, expandClosed,
|
||||
DEFAULT_INDICES_OPTIONS);
|
||||
} else if (TEMPLATE_FIELD.match(currentFieldName)) {
|
||||
template = Script.parse(parser, ParseFieldMatcher.STRICT, Script.DEFAULT_TEMPLATE_LANG);
|
||||
template = Script.parse(parser, Script.DEFAULT_TEMPLATE_LANG);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not read search request. unexpected object field [" +
|
||||
currentFieldName + "]");
|
||||
|
@ -6,7 +6,6 @@
|
||||
package org.elasticsearch.xpack.watcher.transform.script;
|
||||
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.script.Script;
|
||||
@ -56,7 +55,7 @@ public class ScriptTransform implements Transform {
|
||||
|
||||
public static ScriptTransform parse(String watchId, XContentParser parser) throws IOException {
|
||||
try {
|
||||
Script script = Script.parse(parser, ParseFieldMatcher.STRICT);
|
||||
Script script = Script.parse(parser);
|
||||
return new ScriptTransform(script);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] transform for watch [{}]. failed to parse script", pe, TYPE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user