Merge pull request #21136 from jdconrad/stype
Refactor ScriptType to be a top-level class.
This commit is contained in:
commit
7a7d6ea8e6
|
@ -42,8 +42,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
|||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -232,7 +231,7 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
* @deprecated Use {@link #script()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public ScriptService.ScriptType scriptType() {
|
||||
public ScriptType scriptType() {
|
||||
return this.script == null ? null : this.script.getType();
|
||||
}
|
||||
|
||||
|
@ -252,7 +251,7 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
* @deprecated Use {@link #script(Script)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public UpdateRequest script(String script, ScriptService.ScriptType scriptType) {
|
||||
public UpdateRequest script(String script, ScriptType scriptType) {
|
||||
updateOrCreateScript(script, scriptType, null, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -347,7 +346,7 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
* @deprecated Use {@link #script(Script)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public UpdateRequest script(String script, ScriptService.ScriptType scriptType, @Nullable Map<String, Object> scriptParams) {
|
||||
public UpdateRequest script(String script, ScriptType scriptType, @Nullable Map<String, Object> scriptParams) {
|
||||
this.script = new Script(script, scriptType, null, scriptParams);
|
||||
return this;
|
||||
}
|
||||
|
@ -369,7 +368,7 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
* @deprecated Use {@link #script(Script)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public UpdateRequest script(String script, @Nullable String scriptLang, ScriptService.ScriptType scriptType,
|
||||
public UpdateRequest script(String script, @Nullable String scriptLang, ScriptType scriptType,
|
||||
@Nullable Map<String, Object> scriptParams) {
|
||||
this.script = new Script(script, scriptType, scriptLang, scriptParams);
|
||||
return this;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
@ -42,7 +43,7 @@ public class InternalTemplateService implements TemplateService {
|
|||
int mustacheStart = template.indexOf("{{");
|
||||
int mustacheEnd = template.indexOf("}}");
|
||||
if (mustacheStart != -1 && mustacheEnd != -1 && mustacheStart < mustacheEnd) {
|
||||
Script script = new Script(template, ScriptService.ScriptType.INLINE, "mustache", Collections.emptyMap());
|
||||
Script script = new Script(template, ScriptType.INLINE, "mustache", Collections.emptyMap());
|
||||
CompiledScript compiledScript = scriptService.compile(
|
||||
script,
|
||||
ScriptContext.Standard.INGEST,
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.elasticsearch.script;
|
|||
*/
|
||||
public class CompiledScript {
|
||||
|
||||
private final ScriptService.ScriptType type;
|
||||
private final ScriptType type;
|
||||
private final String name;
|
||||
private final String lang;
|
||||
private final Object compiled;
|
||||
|
@ -36,7 +36,7 @@ public class CompiledScript {
|
|||
* @param lang The language of the script to be executed.
|
||||
* @param compiled The compiled script Object that is executable.
|
||||
*/
|
||||
public CompiledScript(ScriptService.ScriptType type, String name, String lang, Object compiled) {
|
||||
public CompiledScript(ScriptType type, String name, String lang, Object compiled) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.lang = lang;
|
||||
|
@ -47,7 +47,7 @@ public class CompiledScript {
|
|||
* Method to get the type of language.
|
||||
* @return The type of language the script was compiled in.
|
||||
*/
|
||||
public ScriptService.ScriptType type() {
|
||||
public ScriptType type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.elasticsearch.script;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -81,8 +79,8 @@ public final class ScriptContextRegistry {
|
|||
}
|
||||
|
||||
private static Set<String> reservedScriptContexts() {
|
||||
Set<String> reserved = new HashSet<>(ScriptService.ScriptType.values().length + ScriptContext.Standard.values().length);
|
||||
for (ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
Set<String> reserved = new HashSet<>(ScriptType.values().length + ScriptContext.Standard.values().length);
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
reserved.add(scriptType.toString());
|
||||
}
|
||||
for (ScriptContext.Standard scriptContext : ScriptContext.Standard.values()) {
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.script;
|
|||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.ClusterStateListener;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.breaker.CircuitBreakingException;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
|
@ -46,8 +45,6 @@ import org.elasticsearch.common.cache.RemovalNotification;
|
|||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.io.Streams;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -70,7 +67,6 @@ import java.nio.file.Path;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
@ -632,68 +628,6 @@ public class ScriptService extends AbstractComponent implements Closeable, Clust
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of a script, more specifically where it gets loaded from:
|
||||
* - provided dynamically at request time
|
||||
* - loaded from an index
|
||||
* - loaded from file
|
||||
*/
|
||||
public enum ScriptType {
|
||||
|
||||
INLINE(0, "inline", "inline", false),
|
||||
STORED(1, "id", "stored", false),
|
||||
FILE(2, "file", "file", true);
|
||||
|
||||
private final int val;
|
||||
private final ParseField parseField;
|
||||
private final String scriptType;
|
||||
private final boolean defaultScriptEnabled;
|
||||
|
||||
public static ScriptType readFrom(StreamInput in) throws IOException {
|
||||
int scriptTypeVal = in.readVInt();
|
||||
for (ScriptType type : values()) {
|
||||
if (type.val == scriptTypeVal) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value read for ScriptType got [" + scriptTypeVal + "] expected one of ["
|
||||
+ INLINE.val + "," + FILE.val + "," + STORED.val + "]");
|
||||
}
|
||||
|
||||
public static void writeTo(ScriptType scriptType, StreamOutput out) throws IOException{
|
||||
if (scriptType != null) {
|
||||
out.writeVInt(scriptType.val);
|
||||
} else {
|
||||
out.writeVInt(INLINE.val); //Default to inline
|
||||
}
|
||||
}
|
||||
|
||||
ScriptType(int val, String name, String scriptType, boolean defaultScriptEnabled) {
|
||||
this.val = val;
|
||||
this.parseField = new ParseField(name);
|
||||
this.scriptType = scriptType;
|
||||
this.defaultScriptEnabled = defaultScriptEnabled;
|
||||
}
|
||||
|
||||
public ParseField getParseField() {
|
||||
return parseField;
|
||||
}
|
||||
|
||||
public boolean getDefaultScriptEnabled() {
|
||||
return defaultScriptEnabled;
|
||||
}
|
||||
|
||||
public String getScriptType() {
|
||||
return scriptType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final class CacheKey {
|
||||
final String lang;
|
||||
final String name;
|
||||
|
|
|
@ -43,11 +43,11 @@ public class ScriptSettings {
|
|||
@Deprecated
|
||||
public static final String LEGACY_SCRIPT_SETTING = "script.legacy.default_lang";
|
||||
|
||||
private static final Map<ScriptService.ScriptType, Setting<Boolean>> SCRIPT_TYPE_SETTING_MAP;
|
||||
private static final Map<ScriptType, Setting<Boolean>> SCRIPT_TYPE_SETTING_MAP;
|
||||
|
||||
static {
|
||||
Map<ScriptService.ScriptType, Setting<Boolean>> scriptTypeSettingMap = new HashMap<>();
|
||||
for (ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
Map<ScriptType, Setting<Boolean>> scriptTypeSettingMap = new HashMap<>();
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
scriptTypeSettingMap.put(scriptType, Setting.boolSetting(
|
||||
ScriptModes.sourceKey(scriptType),
|
||||
scriptType.getDefaultScriptEnabled(),
|
||||
|
@ -84,7 +84,7 @@ public class ScriptSettings {
|
|||
return scriptContextSettingMap;
|
||||
}
|
||||
|
||||
private static List<Setting<Boolean>> languageSettings(Map<ScriptService.ScriptType, Setting<Boolean>> scriptTypeSettingMap,
|
||||
private static List<Setting<Boolean>> languageSettings(Map<ScriptType, Setting<Boolean>> scriptTypeSettingMap,
|
||||
Map<ScriptContext, Setting<Boolean>> scriptContextSettingMap,
|
||||
ScriptEngineRegistry scriptEngineRegistry,
|
||||
ScriptContextRegistry scriptContextRegistry) {
|
||||
|
@ -96,13 +96,13 @@ public class ScriptSettings {
|
|||
continue;
|
||||
}
|
||||
final String language = scriptEngineRegistry.getLanguage(scriptEngineService);
|
||||
for (final ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
for (final ScriptType scriptType : ScriptType.values()) {
|
||||
// Top level, like "script.engine.groovy.inline"
|
||||
final boolean defaultNonFileScriptMode = scriptEngineRegistry.getDefaultInlineScriptEnableds().get(language);
|
||||
boolean defaultLangAndType = defaultNonFileScriptMode;
|
||||
// Files are treated differently because they are never default-deny
|
||||
if (ScriptService.ScriptType.FILE == scriptType) {
|
||||
defaultLangAndType = ScriptService.ScriptType.FILE.getDefaultScriptEnabled();
|
||||
if (ScriptType.FILE == scriptType) {
|
||||
defaultLangAndType = ScriptType.FILE.getDefaultScriptEnabled();
|
||||
}
|
||||
final boolean defaultIfNothingSet = defaultLangAndType;
|
||||
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.script;
|
||||
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The type of a script, more specifically where it gets loaded from:
|
||||
* - provided dynamically at request time
|
||||
* - loaded from an index
|
||||
* - loaded from file
|
||||
*/
|
||||
public enum ScriptType {
|
||||
|
||||
INLINE(0, "inline", "inline", false),
|
||||
STORED(1, "id", "stored", false),
|
||||
FILE(2, "file", "file", true);
|
||||
|
||||
private final int val;
|
||||
private final ParseField parseField;
|
||||
private final String scriptType;
|
||||
private final boolean defaultScriptEnabled;
|
||||
|
||||
public static ScriptType readFrom(StreamInput in) throws IOException {
|
||||
int scriptTypeVal = in.readVInt();
|
||||
for (ScriptType type : values()) {
|
||||
if (type.val == scriptTypeVal) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value read for ScriptType got [" + scriptTypeVal + "] expected one of ["
|
||||
+ INLINE.val + "," + FILE.val + "," + STORED.val + "]");
|
||||
}
|
||||
|
||||
public static void writeTo(ScriptType scriptType, StreamOutput out) throws IOException{
|
||||
if (scriptType != null) {
|
||||
out.writeVInt(scriptType.val);
|
||||
} else {
|
||||
out.writeVInt(INLINE.val); //Default to inline
|
||||
}
|
||||
}
|
||||
|
||||
ScriptType(int val, String name, String scriptType, boolean defaultScriptEnabled) {
|
||||
this.val = val;
|
||||
this.parseField = new ParseField(name);
|
||||
this.scriptType = scriptType;
|
||||
this.defaultScriptEnabled = defaultScriptEnabled;
|
||||
}
|
||||
|
||||
public ParseField getParseField() {
|
||||
return parseField;
|
||||
}
|
||||
|
||||
public boolean getDefaultScriptEnabled() {
|
||||
return defaultScriptEnabled;
|
||||
}
|
||||
|
||||
public String getScriptType() {
|
||||
return scriptType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
|
@ -39,11 +39,10 @@ import org.elasticsearch.index.analysis.TokenFilterFactory;
|
|||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.suggest.SuggestionBuilder;
|
||||
import org.elasticsearch.search.suggest.SuggestionSearchContext.SuggestionContext;
|
||||
import org.elasticsearch.search.suggest.phrase.PhraseSuggestionContext.DirectCandidateGenerator;
|
||||
|
@ -394,7 +393,7 @@ public class PhraseSuggestionBuilder extends SuggestionBuilder<PhraseSuggestionB
|
|||
* Sets a query used for filtering out suggested phrases (collation).
|
||||
*/
|
||||
public PhraseSuggestionBuilder collateQuery(String collateQuery) {
|
||||
this.collateQuery = new Script(collateQuery, ScriptService.ScriptType.INLINE, "mustache", Collections.emptyMap());
|
||||
this.collateQuery = new Script(collateQuery, ScriptType.INLINE, "mustache", Collections.emptyMap());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.action.search.SearchTransportService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
@ -259,7 +259,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
String indexOrAlias = randomIndexOrAlias();
|
||||
client().prepareIndex(indexOrAlias, "type", "id").setSource("field", "value").get();
|
||||
UpdateRequest updateRequest = new UpdateRequest(indexOrAlias, "type", "id")
|
||||
.script(new Script("ctx.op='delete'", ScriptService.ScriptType.INLINE, CustomScriptPlugin.NAME, Collections.emptyMap()));
|
||||
.script(new Script("ctx.op='delete'", ScriptType.INLINE, CustomScriptPlugin.NAME, Collections.emptyMap()));
|
||||
UpdateResponse updateResponse = internalCluster().coordOnlyNodeClient().update(updateRequest).actionGet();
|
||||
assertEquals(DocWriteResponse.Result.DELETED, updateResponse.getResult());
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ import java.util.function.Function;
|
|||
|
||||
import static org.elasticsearch.action.DocWriteRequest.OpType;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptContextRegistry;
|
||||
import org.elasticsearch.script.ScriptEngineRegistry;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.ScriptSettings;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.discovery.MasterNotDiscoveredException;
|
|||
import org.elasticsearch.discovery.zen.ZenDiscovery;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
@ -122,12 +122,12 @@ public class NoMasterNodeIT extends ESIntegTestCase {
|
|||
checkWriteAction(
|
||||
false, timeout,
|
||||
client().prepareUpdate("test", "type1", "1")
|
||||
.setScript(new Script("test script", ScriptService.ScriptType.INLINE, null, null)).setTimeout(timeout));
|
||||
.setScript(new Script("test script", ScriptType.INLINE, null, null)).setTimeout(timeout));
|
||||
|
||||
checkWriteAction(
|
||||
autoCreateIndex, timeout,
|
||||
client().prepareUpdate("no_index", "type1", "1")
|
||||
.setScript(new Script("test script", ScriptService.ScriptType.INLINE, null, null)).setTimeout(timeout));
|
||||
.setScript(new Script("test script", ScriptType.INLINE, null, null)).setTimeout(timeout));
|
||||
|
||||
|
||||
checkWriteAction(false, timeout,
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.rest.RestStatus;
|
|||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
|||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
|
||||
import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
|
||||
|
@ -319,7 +319,7 @@ public class InnerHitBuilderTests extends ESTestCase {
|
|||
}
|
||||
|
||||
static SearchSourceBuilder.ScriptField randomScript() {
|
||||
ScriptService.ScriptType randomScriptType = randomFrom(ScriptService.ScriptType.values());
|
||||
ScriptType randomScriptType = randomFrom(ScriptType.values());
|
||||
Map<String, Object> randomMap = null;
|
||||
if (randomBoolean()) {
|
||||
randomMap = new HashMap<>();
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.index.query.MoreLikeThisQueryBuilder.Item;
|
|||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
|
||||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.elasticsearch.index.query.ScriptQueryBuilder.ScriptQuery;
|
||||
import org.elasticsearch.script.MockScriptEngine;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.plugins.SearchPlugin;
|
||||
import org.elasticsearch.script.MockScriptEngine;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.MultiValueMode;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
@ -168,7 +168,7 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
|
|||
String script = "1";
|
||||
Map<String, Object> params = Collections.emptyMap();
|
||||
functionBuilder = new ScriptScoreFunctionBuilder(
|
||||
new Script(script, ScriptService.ScriptType.INLINE, MockScriptEngine.NAME, params));
|
||||
new Script(script, ScriptType.INLINE, MockScriptEngine.NAME, params));
|
||||
break;
|
||||
case 3:
|
||||
RandomScoreFunctionBuilder randomScoreFunctionBuilder = new RandomScoreFunctionBuilderWithFixedSeed();
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.elasticsearch.test.ESTestCase;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
// TODO: these really should just be part of ScriptService tests, there is nothing special about them
|
||||
public class FileScriptTests extends ESTestCase {
|
||||
|
@ -56,7 +54,7 @@ public class FileScriptTests extends ESTestCase {
|
|||
Settings settings = Settings.builder()
|
||||
.put("script.engine." + MockScriptEngine.NAME + ".file.aggs", "false").build();
|
||||
ScriptService scriptService = makeScriptService(settings);
|
||||
Script script = new Script("script1", ScriptService.ScriptType.FILE, MockScriptEngine.NAME, null);
|
||||
Script script = new Script("script1", ScriptType.FILE, MockScriptEngine.NAME, null);
|
||||
CompiledScript compiledScript = scriptService.compile(script, ScriptContext.Standard.SEARCH, Collections.emptyMap());
|
||||
assertNotNull(compiledScript);
|
||||
MockCompiledScript executable = (MockCompiledScript) compiledScript.compiled();
|
||||
|
@ -71,7 +69,7 @@ public class FileScriptTests extends ESTestCase {
|
|||
.put("script.engine." + MockScriptEngine.NAME + ".file.update", "false")
|
||||
.put("script.engine." + MockScriptEngine.NAME + ".file.ingest", "false").build();
|
||||
ScriptService scriptService = makeScriptService(settings);
|
||||
Script script = new Script("script1", ScriptService.ScriptType.FILE, MockScriptEngine.NAME, null);
|
||||
Script script = new Script("script1", ScriptType.FILE, MockScriptEngine.NAME, null);
|
||||
for (ScriptContext context : ScriptContext.Standard.values()) {
|
||||
try {
|
||||
scriptService.compile(script, context, Collections.emptyMap());
|
||||
|
|
|
@ -48,7 +48,7 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.common.Nullable;
|
|||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.InternalSettingsPlugin;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
|
|
|
@ -25,9 +25,7 @@ import org.elasticsearch.test.ESTestCase;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
|
@ -58,7 +56,7 @@ public class ScriptContextTests extends ESTestCase {
|
|||
|
||||
public void testCustomGlobalScriptContextSettings() throws Exception {
|
||||
ScriptService scriptService = makeScriptService();
|
||||
for (ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
try {
|
||||
Script script = new Script("1", scriptType, MockScriptEngine.NAME, null);
|
||||
scriptService.compile(script, new ScriptContext.Plugin(PLUGIN_NAME, "custom_globally_disabled_op"), Collections.emptyMap());
|
||||
|
@ -71,7 +69,7 @@ public class ScriptContextTests extends ESTestCase {
|
|||
|
||||
public void testCustomScriptContextSettings() throws Exception {
|
||||
ScriptService scriptService = makeScriptService();
|
||||
Script script = new Script("1", ScriptService.ScriptType.INLINE, MockScriptEngine.NAME, null);
|
||||
Script script = new Script("1", ScriptType.INLINE, MockScriptEngine.NAME, null);
|
||||
try {
|
||||
scriptService.compile(script, new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op"), Collections.emptyMap());
|
||||
fail("script compilation should have been rejected");
|
||||
|
@ -87,7 +85,7 @@ public class ScriptContextTests extends ESTestCase {
|
|||
|
||||
public void testUnknownPluginScriptContext() throws Exception {
|
||||
ScriptService scriptService = makeScriptService();
|
||||
for (ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
try {
|
||||
Script script = new Script("1", scriptType, MockScriptEngine.NAME, null);
|
||||
scriptService.compile(script, new ScriptContext.Plugin(PLUGIN_NAME, "unknown"), Collections.emptyMap());
|
||||
|
@ -106,7 +104,7 @@ public class ScriptContextTests extends ESTestCase {
|
|||
}
|
||||
};
|
||||
ScriptService scriptService = makeScriptService();
|
||||
for (ScriptService.ScriptType scriptType : ScriptService.ScriptType.values()) {
|
||||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
try {
|
||||
Script script = new Script("1", scriptType, MockScriptEngine.NAME, null);
|
||||
scriptService.compile(script, context, Collections.emptyMap());
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.Nullable;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.script;
|
|||
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.search.lookup.SearchLookup;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.After;
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.common.io.Streams;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.search.lookup.SearchLookup;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
|
|
|
@ -66,9 +66,9 @@ public class ScriptTests extends ESTestCase {
|
|||
|
||||
private Script createScript(XContent xContent) throws IOException {
|
||||
final Map<String, Object> params = randomBoolean() ? null : Collections.singletonMap("key", "value");
|
||||
ScriptService.ScriptType scriptType = randomFrom(ScriptService.ScriptType.values());
|
||||
ScriptType scriptType = randomFrom(ScriptType.values());
|
||||
String script;
|
||||
if (scriptType == ScriptService.ScriptType.INLINE) {
|
||||
if (scriptType == ScriptType.INLINE) {
|
||||
try (XContentBuilder builder = XContentBuilder.builder(xContent)) {
|
||||
builder.startObject();
|
||||
builder.field("field", randomAsciiOfLengthBetween(1, 5));
|
||||
|
@ -83,7 +83,7 @@ public class ScriptTests extends ESTestCase {
|
|||
scriptType,
|
||||
randomFrom("_lang1", "_lang2", null),
|
||||
params,
|
||||
scriptType == ScriptService.ScriptType.INLINE ? xContent.type() : null
|
||||
scriptType == ScriptType.INLINE ? xContent.type() : null
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.elasticsearch.script.AbstractSearchScript;
|
|||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.tasks.TaskInfo;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ import org.elasticsearch.script.AbstractSearchScript;
|
|||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
|
@ -28,7 +28,8 @@ import java.util.Map;
|
|||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
/**
|
||||
* This class contains various mocked scripts that are used in aggregations integration tests.
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.index.query.RangeQueryBuilder;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.index.query.MatchNoneQueryBuilder;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.DateScriptMocks.DateScriptsMockPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.DateScriptMocks.DateScriptsMockPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
|
|
|
@ -27,10 +27,9 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScoreAccessor;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.LongTermsIT.CustomScriptPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
|
|
|
@ -37,8 +37,7 @@ import org.elasticsearch.script.AbstractSearchScript;
|
|||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
|
|
@ -26,10 +26,9 @@ import org.elasticsearch.index.fielddata.ScriptDocValues;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.StringTermsIT.CustomScriptPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.index.fielddata.ScriptDocValues;
|
|||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
|
||||
|
@ -151,7 +151,7 @@ public class MinDocCountIT extends AbstractTermsTestCase {
|
|||
YES {
|
||||
@Override
|
||||
TermsAggregationBuilder apply(TermsAggregationBuilder builder, String field) {
|
||||
return builder.script(new org.elasticsearch.script.Script("doc['" + field + "'].values", ScriptService.ScriptType.INLINE,
|
||||
return builder.script(new org.elasticsearch.script.Script("doc['" + field + "'].values", ScriptType.INLINE,
|
||||
CustomScriptPlugin.NAME, null));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.index.fielddata.ScriptDocValues;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -34,8 +34,6 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
|||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -47,7 +45,6 @@ import java.util.function.Function;
|
|||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateRange;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.plugins.ScriptPlugin;
|
|||
import org.elasticsearch.plugins.SearchPlugin;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.Aggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.index.mapper.IndexFieldMapper;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationExecutionException;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.LeafSearchScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.fielddata.ScriptDocValues;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.common.logging.Loggers;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
@ -565,4 +565,4 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
|
|||
.getMissCount(), equalTo(1L));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
@ -391,4 +391,4 @@ public class MaxIT extends AbstractNumericTestCase {
|
|||
assertThat(client().admin().indices().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache()
|
||||
.getMissCount(), equalTo(1L));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
@ -404,4 +404,4 @@ public class MinIT extends AbstractNumericTestCase {
|
|||
assertThat(client().admin().indices().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache()
|
||||
.getMissCount(), equalTo(1L));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.env.Environment;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.Aggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.search.aggregations.metrics;
|
||||
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetricAggregationBuilder;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.action.search.ShardSearchFailure;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.LeafSearchScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
|
|
|
@ -34,8 +34,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.MockScriptEngine;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHitField;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
|
@ -584,7 +583,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
|||
.explain(true)
|
||||
.storedField("text")
|
||||
.fieldDataField("field1")
|
||||
.scriptField("script", new Script("5", ScriptService.ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap()))
|
||||
.scriptField("script", new Script("5", ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap()))
|
||||
.fetchSource("text", null)
|
||||
.version(true)
|
||||
)
|
||||
|
@ -866,7 +865,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
|||
nested("to-comments", "comments").subAggregation(
|
||||
topHits("top-comments").size(1).highlighter(new HighlightBuilder().field(hlField)).explain(true)
|
||||
.fieldDataField("comments.user")
|
||||
.scriptField("script", new Script("5", ScriptService.ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap())).fetchSource("comments.message", null)
|
||||
.scriptField("script", new Script("5", ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap())).fetchSource("comments.message", null)
|
||||
.version(true).sort("comments.date", SortOrder.ASC))).get();
|
||||
assertHitCount(searchResponse, 2);
|
||||
Nested nested = searchResponse.getAggregations().get("to-comments");
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.LeafSearchScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
||||
|
|
|
@ -26,13 +26,12 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.search.aggregations.pipeline;
|
||||
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.BasePipelineAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
import org.elasticsearch.search.aggregations.pipeline.bucketscript.BucketScriptPipelineAggregationBuilder;
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.search.aggregations.pipeline;
|
||||
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.BasePipelineAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
import org.elasticsearch.search.aggregations.pipeline.bucketselector.BucketSelectorPipelineAggregationBuilder;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.index.query.GeohashCellQuery;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.functionscore.ScriptScoreFunctionBuilder;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.Scroll;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
|
@ -450,7 +450,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase {
|
|||
|
||||
MultiSearchResponse response = client().prepareMultiSearch()
|
||||
// Add custom score query with bogus script
|
||||
.add(client().prepareSearch("test").setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("nid", 1), new ScriptScoreFunctionBuilder(new Script("foo", ScriptService.ScriptType.INLINE, "bar", null)))))
|
||||
.add(client().prepareSearch("test").setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("nid", 1), new ScriptScoreFunctionBuilder(new Script("foo", ScriptType.INLINE, "bar", null)))))
|
||||
.add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("nid", 2)))
|
||||
.add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery()))
|
||||
.execute().actionGet();
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.MockScriptEngine;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
|
@ -167,7 +167,7 @@ public class InnerHitsIT extends ESIntegTestCase {
|
|||
.setExplain(true)
|
||||
.addDocValueField("comments.message")
|
||||
.addScriptField("script",
|
||||
new Script("5", ScriptService.ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap()))
|
||||
new Script("5", ScriptType.INLINE, MockScriptEngine.NAME, Collections.emptyMap()))
|
||||
.setSize(1)
|
||||
)).get();
|
||||
assertNoFailures(response);
|
||||
|
@ -301,7 +301,7 @@ public class InnerHitsIT extends ESIntegTestCase {
|
|||
.addDocValueField("message")
|
||||
.setHighlightBuilder(new HighlightBuilder().field("message"))
|
||||
.setExplain(true).setSize(1)
|
||||
.addScriptField("script", new Script("5", ScriptService.ScriptType.INLINE,
|
||||
.addScriptField("script", new Script("5", ScriptType.INLINE,
|
||||
MockScriptEngine.NAME, Collections.emptyMap()))
|
||||
)
|
||||
).get();
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHitField;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.ExplainableSearchScript;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
|
|
@ -48,7 +48,8 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
|||
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.ScoreAccessor;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.Aggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.fielddata.ScriptDocValues;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.elasticsearch.script.ScriptEngineRegistry;
|
|||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptServiceTests.TestEngineService;
|
||||
import org.elasticsearch.script.ScriptSettings;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ import java.util.function.Function;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import static org.elasticsearch.search.sort.SortBuilders.scriptSort;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.elasticsearch.index.search.stats.SearchStats.Stats;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.index.engine.DocumentMissingException;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHitField;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
|
@ -115,7 +115,7 @@ public class TimestampTTLBWIT extends ESIntegTestCase {
|
|||
|
||||
try {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
fail();
|
||||
} catch (DocumentMissingException e) {
|
||||
// all is well
|
||||
|
@ -127,14 +127,14 @@ public class TimestampTTLBWIT extends ESIntegTestCase {
|
|||
long ttl = ((Number) getResponse.getField("_ttl").getValue()).longValue();
|
||||
assertThat(ttl, greaterThan(0L));
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "2")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
getResponse = client().prepareGet("test", "type1", "2").setStoredFields("_ttl").execute().actionGet();
|
||||
ttl = ((Number) getResponse.getField("_ttl").getValue()).longValue();
|
||||
assertThat(ttl, greaterThan(0L));
|
||||
|
||||
// check TTL update
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "2")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values",
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values",
|
||||
Collections.singletonMap("_ctx", Collections.singletonMap("_ttl", 3600000)))).execute().actionGet();
|
||||
getResponse = client().prepareGet("test", "type1", "2").setStoredFields("_ttl").execute().actionGet();
|
||||
ttl = ((Number) getResponse.getField("_ttl").getValue()).longValue();
|
||||
|
@ -144,7 +144,7 @@ public class TimestampTTLBWIT extends ESIntegTestCase {
|
|||
// check timestamp update
|
||||
client().prepareIndex("test", "type1", "3").setSource("field", 1).setRefreshPolicy(IMMEDIATE).get();
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "3")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values",
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values",
|
||||
Collections.singletonMap("_ctx", Collections.singletonMap("_timestamp", "2009-11-15T14:12:12")))).execute()
|
||||
.actionGet();
|
||||
getResponse = client().prepareGet("test", "type1", "3").setStoredFields("_timestamp").execute().actionGet();
|
||||
|
@ -198,7 +198,7 @@ public class TimestampTTLBWIT extends ESIntegTestCase {
|
|||
// Update the first object and note context variables values
|
||||
UpdateResponse updateResponse = client().prepareUpdate("test", "subtype1", "id1")
|
||||
.setRouting("routing1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "extract_ctx", null))
|
||||
.setScript(new Script("", ScriptType.INLINE, "extract_ctx", null))
|
||||
.execute().actionGet();
|
||||
|
||||
assertEquals(2, updateResponse.getVersion());
|
||||
|
@ -215,7 +215,7 @@ public class TimestampTTLBWIT extends ESIntegTestCase {
|
|||
|
||||
// Idem with the second object
|
||||
updateResponse = client().prepareUpdate("test", "type1", "parentId1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "extract_ctx", null))
|
||||
.setScript(new Script("", ScriptType.INLINE, "extract_ctx", null))
|
||||
.execute().actionGet();
|
||||
|
||||
assertEquals(2, updateResponse.getVersion());
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.NativeScriptEngineService;
|
||||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
@ -58,7 +57,7 @@ public class UpdateByNativeScriptIT extends ESIntegTestCase {
|
|||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("foo", "SETVALUE");
|
||||
client().prepareUpdate("test", "type", "1")
|
||||
.setScript(new Script("custom", ScriptService.ScriptType.INLINE, NativeScriptEngineService.NAME, params)).get();
|
||||
.setScript(new Script("custom", ScriptType.INLINE, NativeScriptEngineService.NAME, params)).get();
|
||||
|
||||
Map<String, Object> data = client().prepareGet("test", "type", "1").get().getSource();
|
||||
assertThat(data, hasKey("foo"));
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.elasticsearch.script.CompiledScript;
|
|||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.lookup.SearchLookup;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -369,7 +369,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.execute().actionGet();
|
||||
assertEquals(DocWriteResponse.Result.CREATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -381,7 +381,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.execute().actionGet();
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -410,7 +410,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("balance", openingBalance).endObject())
|
||||
.setScriptedUpsert(true)
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "scripted_upsert", params))
|
||||
.setScript(new Script("", ScriptType.INLINE, "scripted_upsert", params))
|
||||
.execute().actionGet();
|
||||
assertEquals(DocWriteResponse.Result.CREATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -424,7 +424,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("balance", openingBalance).endObject())
|
||||
.setScriptedUpsert(true)
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "scripted_upsert", params))
|
||||
.setScript(new Script("", ScriptType.INLINE, "scripted_upsert", params))
|
||||
.execute().actionGet();
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -468,7 +468,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("bar", "baz").endObject())
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setFetchSource(true)
|
||||
.execute().actionGet();
|
||||
|
||||
|
@ -480,7 +480,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("bar", "baz").endObject())
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setFields("_source")
|
||||
.execute().actionGet();
|
||||
|
||||
|
@ -498,24 +498,24 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
index("test", "type", "1", "text", "value"); // version is now 1
|
||||
|
||||
assertThrows(client().prepareUpdate(indexOrAlias(), "type", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(2)
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(2)
|
||||
.execute(),
|
||||
VersionConflictEngineException.class);
|
||||
|
||||
client().prepareUpdate(indexOrAlias(), "type", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(1).get();
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(1).get();
|
||||
assertThat(client().prepareGet("test", "type", "1").get().getVersion(), equalTo(2L));
|
||||
|
||||
// and again with a higher version..
|
||||
client().prepareUpdate(indexOrAlias(), "type", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v3"))).setVersion(2).get();
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v3"))).setVersion(2).get();
|
||||
|
||||
assertThat(client().prepareGet("test", "type", "1").get().getVersion(), equalTo(3L));
|
||||
|
||||
// after delete
|
||||
client().prepareDelete("test", "type", "1").get();
|
||||
assertThrows(client().prepareUpdate("test", "type", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(3)
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(3)
|
||||
.execute(),
|
||||
DocumentMissingException.class);
|
||||
|
||||
|
@ -523,7 +523,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "type", "2").setSource("text", "value").setVersion(10).setVersionType(VersionType.EXTERNAL).get();
|
||||
|
||||
assertThrows(client().prepareUpdate(indexOrAlias(), "type", "2")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(2)
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2"))).setVersion(2)
|
||||
.setVersionType(VersionType.EXTERNAL).execute(),
|
||||
ActionRequestValidationException.class);
|
||||
|
||||
|
@ -535,7 +535,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
// With internal versions, tt means "if object is there with version X, update it or explode. If it is not there, index.
|
||||
client().prepareUpdate(indexOrAlias(), "type", "3")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2")))
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("text", "v2")))
|
||||
.setVersion(10).setUpsert("{ \"text\": \"v0\" }").get();
|
||||
get = get("test", "type", "3");
|
||||
assertThat(get.getVersion(), equalTo(1L));
|
||||
|
@ -548,7 +548,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
public void testIndexAutoCreation() throws Exception {
|
||||
UpdateResponse updateResponse = client().prepareUpdate("test", "type1", "1")
|
||||
.setUpsert(XContentFactory.jsonBuilder().startObject().field("bar", "baz").endObject())
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("extra", "foo")))
|
||||
.setFetchSource(true)
|
||||
.execute().actionGet();
|
||||
|
||||
|
@ -565,7 +565,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
try {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
fail();
|
||||
} catch (DocumentMissingException e) {
|
||||
// all is well
|
||||
|
@ -574,7 +574,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "type1", "1").setSource("field", 1).execute().actionGet();
|
||||
|
||||
UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null)).execute().actionGet();
|
||||
assertThat(updateResponse.getVersion(), equalTo(2L));
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -587,7 +587,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("inc", 3);
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", params)).execute().actionGet();
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", params)).execute().actionGet();
|
||||
assertThat(updateResponse.getVersion(), equalTo(3L));
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -599,7 +599,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
// check noop
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("_ctx", Collections.singletonMap("op", "none")))).execute().actionGet();
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("_ctx", Collections.singletonMap("op", "none")))).execute().actionGet();
|
||||
assertThat(updateResponse.getVersion(), equalTo(3L));
|
||||
assertEquals(DocWriteResponse.Result.NOOP, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -611,7 +611,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
// check delete
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "put_values", Collections.singletonMap("_ctx", Collections.singletonMap("op", "delete")))).execute().actionGet();
|
||||
.setScript(new Script("", ScriptType.INLINE, "put_values", Collections.singletonMap("_ctx", Collections.singletonMap("op", "delete")))).execute().actionGet();
|
||||
assertThat(updateResponse.getVersion(), equalTo(4L));
|
||||
assertEquals(DocWriteResponse.Result.DELETED, updateResponse.getResult());
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -624,7 +624,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
// check fields parameter
|
||||
client().prepareIndex("test", "type1", "1").setSource("field", 1).execute().actionGet();
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setFields("field")
|
||||
.setFetchSource(true)
|
||||
.execute().actionGet();
|
||||
|
@ -637,7 +637,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
// check _source parameter
|
||||
client().prepareIndex("test", "type1", "1").setSource("field1", 1, "field2", 2).execute().actionGet();
|
||||
updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field1", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field1", ScriptType.INLINE, "field_inc", null))
|
||||
.setFetchSource("field1", "field2")
|
||||
.get();
|
||||
assertThat(updateResponse.getIndex(), equalTo("test"));
|
||||
|
@ -700,7 +700,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
try {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setDoc(XContentFactory.jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.execute().actionGet();
|
||||
fail("Should have thrown ActionRequestValidationException");
|
||||
} catch (ActionRequestValidationException e) {
|
||||
|
@ -715,7 +715,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
ensureGreen();
|
||||
try {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "1")
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setDocAsUpsert(true)
|
||||
.execute().actionGet();
|
||||
fail("Should have thrown ActionRequestValidationException");
|
||||
|
@ -767,7 +767,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
// Update the first object and note context variables values
|
||||
UpdateResponse updateResponse = client().prepareUpdate("test", "subtype1", "id1")
|
||||
.setRouting("routing1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "extract_ctx", null))
|
||||
.setScript(new Script("", ScriptType.INLINE, "extract_ctx", null))
|
||||
.execute().actionGet();
|
||||
|
||||
assertEquals(2, updateResponse.getVersion());
|
||||
|
@ -783,7 +783,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
|
||||
// Idem with the second object
|
||||
updateResponse = client().prepareUpdate("test", "type1", "parentId1")
|
||||
.setScript(new Script("", ScriptService.ScriptType.INLINE, "extract_ctx", null))
|
||||
.setScript(new Script("", ScriptType.INLINE, "extract_ctx", null))
|
||||
.execute().actionGet();
|
||||
|
||||
assertEquals(2, updateResponse.getVersion());
|
||||
|
@ -822,13 +822,13 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
}
|
||||
if (useBulkApi) {
|
||||
UpdateRequestBuilder updateRequestBuilder = client().prepareUpdate(indexOrAlias(), "type1", Integer.toString(i))
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setRetryOnConflict(Integer.MAX_VALUE)
|
||||
.setUpsert(jsonBuilder().startObject().field("field", 1).endObject());
|
||||
client().prepareBulk().add(updateRequestBuilder).execute().actionGet();
|
||||
} else {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", Integer.toString(i))
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setRetryOnConflict(Integer.MAX_VALUE)
|
||||
.setUpsert(jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.execute().actionGet();
|
||||
|
@ -948,7 +948,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
updateRequestsOutstanding.acquire();
|
||||
try {
|
||||
UpdateRequest ur = client().prepareUpdate("test", "type1", Integer.toString(j))
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setRetryOnConflict(retryOnConflict)
|
||||
.setUpsert(jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.request();
|
||||
|
@ -1048,7 +1048,7 @@ public class UpdateIT extends ESIntegTestCase {
|
|||
//All the previous operations should be complete or failed at this point
|
||||
for (int i = 0; i < numberOfIdsPerThread; ++i) {
|
||||
UpdateResponse ur = client().prepareUpdate("test", "type1", Integer.toString(i))
|
||||
.setScript(new Script("field", ScriptService.ScriptType.INLINE, "field_inc", null))
|
||||
.setScript(new Script("field", ScriptType.INLINE, "field_inc", null))
|
||||
.setRetryOnConflict(Integer.MAX_VALUE)
|
||||
.setUpsert(jsonBuilder().startObject().field("field", 1).endObject())
|
||||
.execute().actionGet();
|
||||
|
|
|
@ -36,9 +36,9 @@ import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationExcept
|
|||
import static org.elasticsearch.ingest.ConfigurationUtils.readOptionalMap;
|
||||
import static org.elasticsearch.ingest.ConfigurationUtils.readOptionalStringProperty;
|
||||
import static org.elasticsearch.ingest.ConfigurationUtils.readStringProperty;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType.FILE;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType.INLINE;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType.STORED;
|
||||
import static org.elasticsearch.script.ScriptType.FILE;
|
||||
import static org.elasticsearch.script.ScriptType.INLINE;
|
||||
import static org.elasticsearch.script.ScriptType.STORED;
|
||||
|
||||
/**
|
||||
* Processor that adds new fields with their corresponding values. If the field is already present, its value
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.index.IndexService;
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ScriptException;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.lookup.SearchLookup;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
|
@ -34,7 +34,7 @@ import java.util.Collections;
|
|||
public class ExpressionTests extends ESSingleNodeTestCase {
|
||||
ExpressionScriptEngineService service;
|
||||
SearchLookup lookup;
|
||||
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
@ -42,7 +42,7 @@ public class ExpressionTests extends ESSingleNodeTestCase {
|
|||
service = new ExpressionScriptEngineService(Settings.EMPTY);
|
||||
lookup = new SearchLookup(index.mapperService(), index.fieldData(), null);
|
||||
}
|
||||
|
||||
|
||||
private SearchScript compile(String expression) {
|
||||
Object compiled = service.compile(null, expression, Collections.emptyMap());
|
||||
return service.search(new CompiledScript(ScriptType.INLINE, "randomName", "expression", compiled), lookup, Collections.<String, Object>emptyMap());
|
||||
|
@ -54,14 +54,14 @@ public class ExpressionTests extends ESSingleNodeTestCase {
|
|||
assertTrue(compile("1/_score").needsScores());
|
||||
assertTrue(compile("doc['d'].value * _score").needsScores());
|
||||
}
|
||||
|
||||
|
||||
public void testCompileError() {
|
||||
ScriptException e = expectThrows(ScriptException.class, () -> {
|
||||
compile("doc['d'].value * *@#)(@$*@#$ + 4");
|
||||
});
|
||||
assertTrue(e.getCause() instanceof ParseException);
|
||||
}
|
||||
|
||||
|
||||
public void testLinkError() {
|
||||
ScriptException e = expectThrows(ScriptException.class, () -> {
|
||||
compile("doc['e'].value * 5");
|
||||
|
|
|
@ -23,8 +23,7 @@ import org.elasticsearch.common.bytes.BytesArray;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -59,7 +58,7 @@ public class IndexedExpressionTests extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "scriptTest", "1").setSource("{\"theField\":\"foo\"}").get();
|
||||
try {
|
||||
client().prepareUpdate("test", "scriptTest", "1")
|
||||
.setScript(new Script("script1", ScriptService.ScriptType.STORED, ExpressionScriptEngineService.NAME, null)).get();
|
||||
.setScript(new Script("script1", ScriptType.STORED, ExpressionScriptEngineService.NAME, null)).get();
|
||||
fail("update script should have been rejected");
|
||||
} catch(Exception e) {
|
||||
assertThat(e.getMessage(), containsString("failed to execute script"));
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.GeneralScriptException;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -164,7 +164,7 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
assertEquals(1985.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1983.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
}
|
||||
|
||||
|
||||
public void testDateObjectMethods() throws Exception {
|
||||
ElasticsearchAssertions.assertAcked(prepareCreate("test").addMapping("doc", "date0", "type=date", "date1", "type=date"));
|
||||
ensureGreen("test");
|
||||
|
@ -257,7 +257,7 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
assertEquals(2.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
|
||||
// make sure count() works for missing
|
||||
rsp = buildRequest("doc['double2'].count()").get();
|
||||
assertSearchResponse(rsp);
|
||||
|
@ -266,7 +266,7 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||
assertEquals(0.0, hits.getAt(1).field("foo").getValue(), 0.0D);
|
||||
assertEquals(0.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||
|
||||
|
||||
// make sure .empty works in the same way
|
||||
rsp = buildRequest("doc['double2'].empty ? 5.0 : 2.0").get();
|
||||
assertSearchResponse(rsp);
|
||||
|
@ -616,7 +616,7 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testGeo() throws Exception {
|
||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1")
|
||||
.startObject("properties").startObject("location").field("type", "geo_point");
|
||||
|
@ -649,7 +649,7 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
assertEquals(1, rsp.getHits().getTotalHits());
|
||||
assertEquals(3170D, rsp.getHits().getAt(0).field("foo").getValue(), 50D);
|
||||
}
|
||||
|
||||
|
||||
public void testBoolean() throws Exception {
|
||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1")
|
||||
.startObject("properties").startObject("vip").field("type", "boolean");
|
||||
|
|
|
@ -28,10 +28,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.groovy.GroovyPlugin;
|
||||
import org.elasticsearch.script.groovy.GroovyScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
|
@ -138,7 +135,7 @@ public class GroovyIndexedScriptTests extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "scriptTest", "1").setSource("{\"theField\":\"foo\"}").get();
|
||||
try {
|
||||
client().prepareUpdate("test", "scriptTest", "1")
|
||||
.setScript(new Script("script1", ScriptService.ScriptType.STORED, GroovyScriptEngineService.NAME, null)).get();
|
||||
.setScript(new Script("script1", ScriptType.STORED, GroovyScriptEngineService.NAME, null)).get();
|
||||
fail("update script should have been rejected");
|
||||
} catch (Exception e) {
|
||||
assertThat(e.getMessage(), containsString("failed to execute script"));
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.lucene.search.function.CombineFunction;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.codehaus.groovy.control.MultipleCompilationErrorsException;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ScriptException;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
@ -139,7 +139,7 @@ public class GroovySecurityTests extends ESTestCase {
|
|||
vars.put("myarray", Arrays.asList("foo"));
|
||||
vars.put("myobject", new MyObject());
|
||||
|
||||
se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "test", "js", se.compile(null, script, Collections.emptyMap())), vars).run();
|
||||
se.executable(new CompiledScript(ScriptType.INLINE, "test", "js", se.compile(null, script, Collections.emptyMap())), vars).run();
|
||||
}
|
||||
|
||||
public static class MyObject {
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.rest.RestController;
|
|||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.action.RestActions;
|
||||
import org.elasticsearch.rest.action.RestToXContentListener;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class RestRenderSearchTemplateAction extends BaseRestHandler {
|
|||
|
||||
String id = request.param("id");
|
||||
if (id != null) {
|
||||
renderRequest.setScriptType(ScriptService.ScriptType.STORED);
|
||||
renderRequest.setScriptType(ScriptType.STORED);
|
||||
renderRequest.setScript(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.elasticsearch.rest.RestRequest;
|
|||
import org.elasticsearch.rest.action.RestActions;
|
||||
import org.elasticsearch.rest.action.RestStatusToXContentListener;
|
||||
import org.elasticsearch.rest.action.search.RestSearchAction;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchRequestParsers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -57,17 +57,17 @@ public class RestSearchTemplateAction extends BaseRestHandler {
|
|||
request.setScriptParams(parser.map())
|
||||
, new ParseField("params"), ObjectParser.ValueType.OBJECT);
|
||||
PARSER.declareString((request, s) -> {
|
||||
request.setScriptType(ScriptService.ScriptType.FILE);
|
||||
request.setScriptType(ScriptType.FILE);
|
||||
request.setScript(s);
|
||||
}, new ParseField("file"));
|
||||
PARSER.declareString((request, s) -> {
|
||||
request.setScriptType(ScriptService.ScriptType.STORED);
|
||||
request.setScriptType(ScriptType.STORED);
|
||||
request.setScript(s);
|
||||
}, new ParseField("id"));
|
||||
PARSER.declareBoolean(SearchTemplateRequest::setExplain, new ParseField("explain"));
|
||||
PARSER.declareBoolean(SearchTemplateRequest::setProfile, new ParseField("profile"));
|
||||
PARSER.declareField((parser, request, value) -> {
|
||||
request.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
request.setScriptType(ScriptType.INLINE);
|
||||
if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
|
||||
try (XContentBuilder builder = XContentFactory.contentBuilder(parser.contentType())) {
|
||||
request.setScript(builder.copyCurrentStructure(parser).bytes().utf8ToString());
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
@ -43,7 +43,7 @@ public class SearchTemplateRequest extends ActionRequest<SearchTemplateRequest>
|
|||
private boolean simulate = false;
|
||||
private boolean explain = false;
|
||||
private boolean profile = false;
|
||||
private ScriptService.ScriptType scriptType;
|
||||
private ScriptType scriptType;
|
||||
private String script;
|
||||
private Map<String, Object> scriptParams;
|
||||
|
||||
|
@ -87,11 +87,11 @@ public class SearchTemplateRequest extends ActionRequest<SearchTemplateRequest>
|
|||
this.profile = profile;
|
||||
}
|
||||
|
||||
public ScriptService.ScriptType getScriptType() {
|
||||
public ScriptType getScriptType() {
|
||||
return scriptType;
|
||||
}
|
||||
|
||||
public void setScriptType(ScriptService.ScriptType scriptType) {
|
||||
public void setScriptType(ScriptType scriptType) {
|
||||
this.scriptType = scriptType;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class SearchTemplateRequest extends ActionRequest<SearchTemplateRequest>
|
|||
simulate = in.readBoolean();
|
||||
explain = in.readBoolean();
|
||||
profile = in.readBoolean();
|
||||
scriptType = ScriptService.ScriptType.readFrom(in);
|
||||
scriptType = ScriptType.readFrom(in);
|
||||
script = in.readOptionalString();
|
||||
if (in.readBoolean()) {
|
||||
scriptParams = in.readMap();
|
||||
|
@ -157,7 +157,7 @@ public class SearchTemplateRequest extends ActionRequest<SearchTemplateRequest>
|
|||
out.writeBoolean(simulate);
|
||||
out.writeBoolean(explain);
|
||||
out.writeBoolean(profile);
|
||||
ScriptService.ScriptType.writeTo(scriptType, out);
|
||||
ScriptType.writeTo(scriptType, out);
|
||||
out.writeOptionalString(script);
|
||||
boolean hasParams = scriptParams != null;
|
||||
out.writeBoolean(hasParams);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.script.mustache;
|
|||
import org.elasticsearch.action.ActionRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class SearchTemplateRequestBuilder
|
|||
return this;
|
||||
}
|
||||
|
||||
public SearchTemplateRequestBuilder setScriptType(ScriptService.ScriptType scriptType) {
|
||||
public SearchTemplateRequestBuilder setScriptType(ScriptType scriptType) {
|
||||
request.setScriptType(scriptType);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -35,13 +35,10 @@ import org.elasticsearch.index.query.QueryBuilder;
|
|||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.index.query.QueryRewriteContext;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
@ -59,11 +56,11 @@ public class TemplateQueryBuilder extends AbstractQueryBuilder<TemplateQueryBuil
|
|||
/** Template to fill. */
|
||||
private final Script template;
|
||||
|
||||
public TemplateQueryBuilder(String template, ScriptService.ScriptType scriptType, Map<String, Object> params) {
|
||||
public TemplateQueryBuilder(String template, ScriptType scriptType, Map<String, Object> params) {
|
||||
this(new Script(template, scriptType, "mustache", params));
|
||||
}
|
||||
|
||||
public TemplateQueryBuilder(String template, ScriptService.ScriptType scriptType, Map<String, Object> params, XContentType ct) {
|
||||
public TemplateQueryBuilder(String template, ScriptType scriptType, Map<String, Object> params, XContentType ct) {
|
||||
this(new Script(template, scriptType, "mustache", params, ct));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Map;
|
|||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType.INLINE;
|
||||
import static org.elasticsearch.script.ScriptType.INLINE;
|
||||
import static org.elasticsearch.script.mustache.CustomMustacheFactory.CONTENT_TYPE_PARAM;
|
||||
import static org.elasticsearch.script.mustache.CustomMustacheFactory.JSON_MIME_TYPE;
|
||||
import static org.elasticsearch.script.mustache.CustomMustacheFactory.PLAIN_TEXT_MIME_TYPE;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder;
|
|||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -74,7 +74,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
|
|||
// Search #1
|
||||
SearchTemplateRequest search1 = new SearchTemplateRequest();
|
||||
search1.setRequest(new SearchRequest("msearch"));
|
||||
search1.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
search1.setScriptType(ScriptType.INLINE);
|
||||
search1.setScript(template);
|
||||
|
||||
Map<String, Object> params1 = new HashMap<>();
|
||||
|
@ -87,7 +87,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
|
|||
// Search #2 (Simulate is true)
|
||||
SearchTemplateRequest search2 = new SearchTemplateRequest();
|
||||
search2.setRequest(new SearchRequest("msearch"));
|
||||
search2.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
search2.setScriptType(ScriptType.INLINE);
|
||||
search2.setScript(template);
|
||||
search2.setSimulate(true);
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
|
|||
// Search #3
|
||||
SearchTemplateRequest search3 = new SearchTemplateRequest();
|
||||
search3.setRequest(new SearchRequest("msearch"));
|
||||
search3.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
search3.setScriptType(ScriptType.INLINE);
|
||||
search3.setScript(template);
|
||||
search3.setSimulate(false);
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
|
|||
// Search #4 (Fail because of unknown index)
|
||||
SearchTemplateRequest search4 = new SearchTemplateRequest();
|
||||
search4.setRequest(new SearchRequest("unknown"));
|
||||
search4.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
search4.setScriptType(ScriptType.INLINE);
|
||||
search4.setScript(template);
|
||||
|
||||
Map<String, Object> params4 = new HashMap<>();
|
||||
|
@ -128,7 +128,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
|
|||
// Search #5 (Simulate is true)
|
||||
SearchTemplateRequest search5 = new SearchTemplateRequest();
|
||||
search5.setRequest(new SearchRequest("msearch"));
|
||||
search5.setScriptType(ScriptService.ScriptType.INLINE);
|
||||
search5.setScriptType(ScriptType.INLINE);
|
||||
search5.setScript("{{! ignore me }}{\"query\":{\"terms\":{\"group\":[{{#groups}}{{.}},{{/groups}}]}}}");
|
||||
search5.setSimulate(true);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.script.mustache;
|
|||
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.StreamsUtils;
|
||||
import org.elasticsearch.test.rest.FakeRestRequest;
|
||||
|
@ -58,9 +58,9 @@ public class MultiSearchTemplateRequestTests extends ESTestCase {
|
|||
assertNotNull(request.requests().get(1).getScript());
|
||||
assertNotNull(request.requests().get(2).getScript());
|
||||
|
||||
assertEquals(ScriptService.ScriptType.INLINE, request.requests().get(0).getScriptType());
|
||||
assertEquals(ScriptService.ScriptType.INLINE, request.requests().get(1).getScriptType());
|
||||
assertEquals(ScriptService.ScriptType.INLINE, request.requests().get(2).getScriptType());
|
||||
assertEquals(ScriptType.INLINE, request.requests().get(0).getScriptType());
|
||||
assertEquals(ScriptType.INLINE, request.requests().get(1).getScriptType());
|
||||
assertEquals(ScriptType.INLINE, request.requests().get(2).getScriptType());
|
||||
assertEquals("{\"query\":{\"match_{{template}}\":{}}}", request.requests().get(0).getScript());
|
||||
assertEquals("{\"query\":{\"match_{{template}}\":{}}}", request.requests().get(1).getScript());
|
||||
assertEquals("{\"query\":{\"match_{{template}}\":{}}}", request.requests().get(2).getScript());
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class MustacheScriptEngineTests extends ESTestCase {
|
|||
+ "\"negative\": {\"term\": {\"body\": {\"value\": \"solr\"}" + "}}, \"negative_boost\": {{boost_val}} } }}";
|
||||
Map<String, Object> vars = new HashMap<>();
|
||||
vars.put("boost_val", "0.3");
|
||||
BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache",
|
||||
BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptType.INLINE, "", "mustache",
|
||||
qe.compile(null, template, compileParams)), vars).run();
|
||||
assertEquals("GET _search {\"query\": {\"boosting\": {\"positive\": {\"match\": {\"body\": \"gift\"}},"
|
||||
+ "\"negative\": {\"term\": {\"body\": {\"value\": \"solr\"}}}, \"negative_boost\": 0.3 } }}",
|
||||
|
@ -71,7 +71,7 @@ public class MustacheScriptEngineTests extends ESTestCase {
|
|||
Map<String, Object> vars = new HashMap<>();
|
||||
vars.put("boost_val", "0.3");
|
||||
vars.put("body_val", "\"quick brown\"");
|
||||
BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache",
|
||||
BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptType.INLINE, "", "mustache",
|
||||
qe.compile(null, template, compileParams)), vars).run();
|
||||
assertEquals("GET _search {\"query\": {\"boosting\": {\"positive\": {\"match\": {\"body\": \"gift\"}},"
|
||||
+ "\"negative\": {\"term\": {\"body\": {\"value\": \"\\\"quick brown\\\"\"}}}, \"negative_boost\": 0.3 } }}",
|
||||
|
@ -83,7 +83,7 @@ public class MustacheScriptEngineTests extends ESTestCase {
|
|||
String templateString = "{" + "\"inline\":{\"match_{{template}}\": {}}," + "\"params\":{\"template\":\"all\"}" + "}";
|
||||
XContentParser parser = XContentFactory.xContent(templateString).createParser(templateString);
|
||||
Script script = Script.parse(parser, new ParseFieldMatcher(false));
|
||||
CompiledScript compiledScript = new CompiledScript(ScriptService.ScriptType.INLINE, null, "mustache",
|
||||
CompiledScript compiledScript = new CompiledScript(ScriptType.INLINE, null, "mustache",
|
||||
qe.compile(null, script.getScript(), Collections.emptyMap()));
|
||||
ExecutableScript executableScript = qe.executable(compiledScript, script.getParams());
|
||||
assertThat(((BytesReference) executableScript.run()).utf8ToString(), equalTo("{\"match_all\":{}}"));
|
||||
|
@ -94,7 +94,7 @@ public class MustacheScriptEngineTests extends ESTestCase {
|
|||
+ " \"template\":\"all\"," + " \"use_it\": true" + " }" + "}";
|
||||
XContentParser parser = XContentFactory.xContent(templateString).createParser(templateString);
|
||||
Script script = Script.parse(parser, new ParseFieldMatcher(false));
|
||||
CompiledScript compiledScript = new CompiledScript(ScriptService.ScriptType.INLINE, null, "mustache",
|
||||
CompiledScript compiledScript = new CompiledScript(ScriptType.INLINE, null, "mustache",
|
||||
qe.compile(null, script.getScript(), Collections.emptyMap()));
|
||||
ExecutableScript executableScript = qe.executable(compiledScript, script.getParams());
|
||||
assertThat(((BytesReference) executableScript.run()).utf8ToString(), equalTo("{ \"match_all\":{} }"));
|
||||
|
|
|
@ -44,7 +44,7 @@ import java.util.Set;
|
|||
import static java.util.Collections.singleton;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.script.ScriptService.ScriptType.INLINE;
|
||||
import static org.elasticsearch.script.ScriptType.INLINE;
|
||||
import static org.hamcrest.Matchers.both;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
|
|
@ -25,8 +25,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
|
@ -269,14 +268,14 @@ public class SearchTemplateIT extends ESSingleNodeTestCase {
|
|||
templateParams.put("fieldParam", "bar");
|
||||
searchResponse = new SearchTemplateRequestBuilder(client())
|
||||
.setRequest(new SearchRequest("test").types("type"))
|
||||
.setScript("/mustache/2").setScriptType(ScriptService.ScriptType.STORED).setScriptParams(templateParams)
|
||||
.setScript("/mustache/2").setScriptType(ScriptType.STORED).setScriptParams(templateParams)
|
||||
.get();
|
||||
assertHitCount(searchResponse.getResponse(), 1);
|
||||
|
||||
Map<String, Object> vars = new HashMap<>();
|
||||
vars.put("fieldParam", "bar");
|
||||
|
||||
TemplateQueryBuilder builder = new TemplateQueryBuilder("3", ScriptService.ScriptType.STORED, vars);
|
||||
TemplateQueryBuilder builder = new TemplateQueryBuilder("3", ScriptType.STORED, vars);
|
||||
SearchResponse sr = client().prepareSearch().setQuery(builder)
|
||||
.execute().actionGet();
|
||||
assertHitCount(sr, 1);
|
||||
|
@ -309,7 +308,7 @@ public class SearchTemplateIT extends ESSingleNodeTestCase {
|
|||
|
||||
ParsingException e = expectThrows(ParsingException.class, () -> new SearchTemplateRequestBuilder(client())
|
||||
.setRequest(new SearchRequest("testindex").types("test"))
|
||||
.setScript("git01").setScriptType(ScriptService.ScriptType.STORED).setScriptParams(templateParams)
|
||||
.setScript("git01").setScriptType(ScriptType.STORED).setScriptParams(templateParams)
|
||||
.get());
|
||||
assertThat(e.getMessage(), containsString("[match] query does not support type ooophrase_prefix"));
|
||||
|
||||
|
@ -321,7 +320,7 @@ public class SearchTemplateIT extends ESSingleNodeTestCase {
|
|||
|
||||
SearchTemplateResponse searchResponse = new SearchTemplateRequestBuilder(client())
|
||||
.setRequest(new SearchRequest("testindex").types("test"))
|
||||
.setScript("git01").setScriptType(ScriptService.ScriptType.STORED).setScriptParams(templateParams)
|
||||
.setScript("git01").setScriptType(ScriptType.STORED).setScriptParams(templateParams)
|
||||
.get();
|
||||
assertHitCount(searchResponse.getResponse(), 1);
|
||||
}
|
||||
|
@ -350,7 +349,7 @@ public class SearchTemplateIT extends ESSingleNodeTestCase {
|
|||
|
||||
SearchTemplateResponse searchResponse = new SearchTemplateRequestBuilder(client())
|
||||
.setRequest(new SearchRequest("test").types("type"))
|
||||
.setScript("/mustache/4").setScriptType(ScriptService.ScriptType.STORED).setScriptParams(arrayTemplateParams)
|
||||
.setScript("/mustache/4").setScriptType(ScriptType.STORED).setScriptParams(arrayTemplateParams)
|
||||
.get();
|
||||
assertHitCount(searchResponse.getResponse(), 5);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.script.mustache;
|
|||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -52,7 +52,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("{\"query\":{\"terms\":{\"status\":[\"{{#status}}\",\"{{.}}\",\"{{/status}}\"]}}}"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.INLINE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.INLINE));
|
||||
assertThat(request.getScriptParams(), nullValue());
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("{\"query\":{\"match\":{\"{{my_field}}\":\"{{my_value}}\"}},\"size\":\"{{my_size}}\"}"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.INLINE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.INLINE));
|
||||
assertThat(request.getScriptParams().size(), equalTo(3));
|
||||
assertThat(request.getScriptParams(), hasEntry("my_field", "foo"));
|
||||
assertThat(request.getScriptParams(), hasEntry("my_value", "bar"));
|
||||
|
@ -83,7 +83,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("{\"query\":{\"bool\":{\"must\":{\"match\":{\"foo\":\"{{text}}\"}}}}}"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.INLINE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.INLINE));
|
||||
assertThat(request.getScriptParams(), nullValue());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("{\"query\":{\"match\":{\"{{field}}\":\"{{value}}\"}}}"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.INLINE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.INLINE));
|
||||
assertThat(request.getScriptParams().size(), equalTo(1));
|
||||
assertThat(request.getScriptParams(), hasKey("status"));
|
||||
assertThat((List<String>) request.getScriptParams().get("status"), hasItems("pending", "published"));
|
||||
|
@ -105,7 +105,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("fileTemplate"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.FILE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.FILE));
|
||||
assertThat(request.getScriptParams(), nullValue());
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("template_foo"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.FILE));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.FILE));
|
||||
assertThat(request.getScriptParams().size(), equalTo(2));
|
||||
assertThat(request.getScriptParams(), hasEntry("foo", "bar"));
|
||||
assertThat(request.getScriptParams(), hasEntry("size", 500));
|
||||
|
@ -125,7 +125,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("storedTemplate"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.STORED));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.STORED));
|
||||
assertThat(request.getScriptParams(), nullValue());
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class SearchTemplateRequestTests extends ESTestCase {
|
|||
|
||||
SearchTemplateRequest request = RestSearchTemplateAction.parse(newBytesReference(source));
|
||||
assertThat(request.getScript(), equalTo("another_template"));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptService.ScriptType.STORED));
|
||||
assertThat(request.getScriptType(), equalTo(ScriptType.STORED));
|
||||
assertThat(request.getScriptParams().size(), equalTo(1));
|
||||
assertThat(request.getScriptParams(), hasEntry("bar", "foo"));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.index.query.TermQueryBuilder;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.junit.Before;
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.painless;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.IndexService;
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.lookup.SearchLookup;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.painless;
|
|||
|
||||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -83,7 +83,7 @@ public class ScriptEngineTests extends ScriptTestCase {
|
|||
|
||||
Object compiledScript = scriptEngine.compile(null,
|
||||
"return ctx.value;", Collections.emptyMap());
|
||||
ExecutableScript script = scriptEngine.executable(new CompiledScript(ScriptService.ScriptType.INLINE,
|
||||
ExecutableScript script = scriptEngine.executable(new CompiledScript(ScriptType.INLINE,
|
||||
"testChangingVarsCrossExecution1", "painless", compiledScript), vars);
|
||||
|
||||
ctx.put("value", 1);
|
||||
|
@ -99,7 +99,7 @@ public class ScriptEngineTests extends ScriptTestCase {
|
|||
Map<String, Object> vars = new HashMap<>();
|
||||
Object compiledScript = scriptEngine.compile(null, "return params['value'];", Collections.emptyMap());
|
||||
|
||||
ExecutableScript script = scriptEngine.executable(new CompiledScript(ScriptService.ScriptType.INLINE,
|
||||
ExecutableScript script = scriptEngine.executable(new CompiledScript(ScriptType.INLINE,
|
||||
"testChangingVarsCrossExecution2", "painless", compiledScript), vars);
|
||||
|
||||
script.setNextVar("value", 1);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.painless.antlr.Walker;
|
|||
import org.elasticsearch.script.CompiledScript;
|
||||
import org.elasticsearch.script.ExecutableScript;
|
||||
import org.elasticsearch.script.ScriptException;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
|
@ -83,7 +83,7 @@ public abstract class ScriptTestCase extends ESTestCase {
|
|||
}
|
||||
// test actual script execution
|
||||
Object object = scriptEngine.compile(null, script, compileParams);
|
||||
CompiledScript compiled = new CompiledScript(ScriptService.ScriptType.INLINE, getTestName(), "painless", object);
|
||||
CompiledScript compiled = new CompiledScript(ScriptType.INLINE, getTestName(), "painless", object);
|
||||
ExecutableScript executableScript = scriptEngine.executable(compiled, vars);
|
||||
if (scorer != null) {
|
||||
((ScorerAware)executableScript).setScorer(scorer);
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
|
@ -42,7 +42,6 @@ import org.elasticsearch.test.ESSingleNodeTestCase;
|
|||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
@ -90,7 +89,7 @@ public class PercolatorQuerySearchIT extends ESSingleNodeTestCase {
|
|||
ensureGreen();
|
||||
client().prepareIndex("index", "type", "1")
|
||||
.setSource(jsonBuilder().startObject().field("query", QueryBuilders.scriptQuery(
|
||||
new Script("1==1", ScriptService.ScriptType.INLINE, CustomScriptPlugin.NAME, null))).endObject())
|
||||
new Script("1==1", ScriptType.INLINE, CustomScriptPlugin.NAME, null))).endObject())
|
||||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||
.execute().actionGet();
|
||||
PercolateResponse response = preparePercolate(client())
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchRequestParsers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -79,7 +79,7 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler<Upda
|
|||
@SuppressWarnings("unchecked")
|
||||
static Script parseScript(Map<String, Object> config, ParseFieldMatcher parseFieldMatcher) {
|
||||
String script = null;
|
||||
ScriptService.ScriptType type = null;
|
||||
ScriptType type = null;
|
||||
String lang = null;
|
||||
Map<String, Object> params = null;
|
||||
for (Iterator<Map.Entry<String, Object>> itr = config.entrySet().iterator(); itr.hasNext();) {
|
||||
|
@ -98,24 +98,24 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler<Upda
|
|||
} else {
|
||||
throw new ElasticsearchParseException("Value must be of type String: [" + parameterName + "]");
|
||||
}
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptService.ScriptType.INLINE.getParseField())) {
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptType.INLINE.getParseField())) {
|
||||
if (parameterValue instanceof String || parameterValue == null) {
|
||||
script = (String) parameterValue;
|
||||
type = ScriptService.ScriptType.INLINE;
|
||||
type = ScriptType.INLINE;
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Value must be of type String: [" + parameterName + "]");
|
||||
}
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptService.ScriptType.FILE.getParseField())) {
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptType.FILE.getParseField())) {
|
||||
if (parameterValue instanceof String || parameterValue == null) {
|
||||
script = (String) parameterValue;
|
||||
type = ScriptService.ScriptType.FILE;
|
||||
type = ScriptType.FILE;
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Value must be of type String: [" + parameterName + "]");
|
||||
}
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptService.ScriptType.STORED.getParseField())) {
|
||||
} else if (parseFieldMatcher.match(parameterName, ScriptType.STORED.getParseField())) {
|
||||
if (parameterValue instanceof String || parameterValue == null) {
|
||||
script = (String) parameterValue;
|
||||
type = ScriptService.ScriptType.STORED;
|
||||
type = ScriptType.STORED;
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Value must be of type String: [" + parameterName + "]");
|
||||
}
|
||||
|
@ -123,8 +123,8 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler<Upda
|
|||
}
|
||||
if (script == null) {
|
||||
throw new ElasticsearchParseException("expected one of [{}], [{}] or [{}] fields, but found none",
|
||||
ScriptService.ScriptType.INLINE.getParseField().getPreferredName(), ScriptService.ScriptType.FILE.getParseField()
|
||||
.getPreferredName(), ScriptService.ScriptType.STORED.getParseField().getPreferredName());
|
||||
ScriptType.INLINE.getParseField().getPreferredName(), ScriptType.FILE.getParseField()
|
||||
.getPreferredName(), ScriptType.STORED.getParseField().getPreferredName());
|
||||
}
|
||||
assert type != null : "if script is not null, type should definitely not be null";
|
||||
return new Script(script, type, lang, params);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue