diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java index 21207070c661c..cdd55b60d7f64 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java @@ -37,6 +37,13 @@ import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestHandler; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.LongFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.IngestScript; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.ScriptContext; @@ -88,6 +95,15 @@ public final class PainlessPlugin extends Plugin implements ScriptPlugin, Extens ingest.add(ingestWhitelist); map.put(IngestScript.CONTEXT, ingest); + // Functions available to runtime fields + map.put(BooleanFieldScript.CONTEXT, getRuntimeFieldWhitelist("boolean")); + map.put(DateFieldScript.CONTEXT, getRuntimeFieldWhitelist("date")); + map.put(DoubleFieldScript.CONTEXT, getRuntimeFieldWhitelist("double")); + map.put(LongFieldScript.CONTEXT, getRuntimeFieldWhitelist("long")); + map.put(StringFieldScript.CONTEXT, getRuntimeFieldWhitelist("string")); + map.put(GeoPointFieldScript.CONTEXT, getRuntimeFieldWhitelist("geopoint")); + map.put(IpFieldScript.CONTEXT, getRuntimeFieldWhitelist("ip")); + // Execute context gets everything List test = new ArrayList<>(Whitelist.BASE_WHITELISTS); test.add(movFnWhitelist); @@ -99,6 +115,14 @@ public final class PainlessPlugin extends Plugin implements ScriptPlugin, Extens whitelists = map; } + private static List getRuntimeFieldWhitelist(String fieldType) { + List scriptField = new ArrayList<>(Whitelist.BASE_WHITELISTS); + Whitelist whitelist = WhitelistLoader.loadFromResourceFiles(Whitelist.class, + "org.elasticsearch.runtimefields." + fieldType + ".txt"); + scriptField.add(whitelist); + return scriptField; + } + private final SetOnce painlessScriptEngine = new SetOnce<>(); @Override diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.boolean.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.boolean.txt new file mode 100644 index 0000000000000..3f1fc1aaa643e --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.boolean.txt @@ -0,0 +1,21 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for boolean-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.BooleanFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.BooleanFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.BooleanFieldScript, boolean) bound_to org.elasticsearch.runtimefields.mapper.BooleanFieldScript$Emit +} + diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.date.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.date.txt new file mode 100644 index 0000000000000..d4c734f0dc91a --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.date.txt @@ -0,0 +1,25 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for date-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.DateFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.DateFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.DateFieldScript, long) bound_to org.elasticsearch.runtimefields.mapper.DateFieldScript$Emit + # Parse a value from the source to millis since epoch + long parse(org.elasticsearch.runtimefields.mapper.DateFieldScript, def) bound_to org.elasticsearch.runtimefields.mapper.DateFieldScript$Parse +} + + + diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.double.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.double.txt new file mode 100644 index 0000000000000..71a40dab06e56 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.double.txt @@ -0,0 +1,21 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for double-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.DoubleFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.DoubleFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.DoubleFieldScript, double) bound_to org.elasticsearch.runtimefields.mapper.DoubleFieldScript$Emit +} + diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.geopoint.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.geopoint.txt new file mode 100644 index 0000000000000..e89f871309d61 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.geopoint.txt @@ -0,0 +1,20 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for ip-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.GeoPointFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.GeoPointFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.GeoPointFieldScript, double, double) bound_to org.elasticsearch.runtimefields.mapper.GeoPointFieldScript$Emit +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.ip.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.ip.txt new file mode 100644 index 0000000000000..a88c01c0f2e09 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.ip.txt @@ -0,0 +1,20 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for ip-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.IpFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.IpFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.IpFieldScript, String) bound_to org.elasticsearch.runtimefields.mapper.IpFieldScript$Emit +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.long.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.long.txt new file mode 100644 index 0000000000000..a8919b8d36a31 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.long.txt @@ -0,0 +1,20 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for long-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.LongFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.LongFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.LongFieldScript, long) bound_to org.elasticsearch.runtimefields.mapper.LongFieldScript$Emit +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.string.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.string.txt new file mode 100644 index 0000000000000..e70a128f255ce --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.runtimefields.string.txt @@ -0,0 +1,20 @@ +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the Server Side Public License, v 1; you may not use this file except +# in compliance with, at your election, the Elastic License 2.0 or the Server +# Side Public License, v 1. +# + +# The whitelist for string-valued runtime fields + +# These two whitelists are required for painless to find the classes +class org.elasticsearch.runtimefields.mapper.StringFieldScript @no_import { +} +class org.elasticsearch.runtimefields.mapper.StringFieldScript$Factory @no_import { +} + +static_import { + # The `emit` callback to collect values for the field + void emit(org.elasticsearch.runtimefields.mapper.StringFieldScript, String) bound_to org.elasticsearch.runtimefields.mapper.StringFieldScript$Emit +} diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java b/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java index 8d4ef0f482a32..aa693318e74c5 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java @@ -8,14 +8,6 @@ package org.elasticsearch.index.mapper; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; - import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.Query; @@ -31,6 +23,14 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.query.SearchExecutionContext; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; + /** A parser for documents, given mappings from a DocumentMapper */ final class DocumentParser { @@ -39,11 +39,10 @@ final class DocumentParser { private final DynamicRuntimeFieldsBuilder dynamicRuntimeFieldsBuilder; DocumentParser(NamedXContentRegistry xContentRegistry, - Function dateParserContext, - DynamicRuntimeFieldsBuilder dynamicRuntimeFieldsBuilder) { + Function dateParserContext) { this.xContentRegistry = xContentRegistry; this.dateParserContext = dateParserContext; - this.dynamicRuntimeFieldsBuilder = dynamicRuntimeFieldsBuilder; + this.dynamicRuntimeFieldsBuilder = org.elasticsearch.runtimefields.mapper.DynamicRuntimeFieldsBuilder.INSTANCE; } ParsedDocument parseDocument(SourceToParse source, diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DynamicRuntimeFieldsBuilder.java b/server/src/main/java/org/elasticsearch/index/mapper/DynamicRuntimeFieldsBuilder.java index 2d30024761b39..54836e1ee0479 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/DynamicRuntimeFieldsBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/DynamicRuntimeFieldsBuilder.java @@ -9,7 +9,6 @@ package org.elasticsearch.index.mapper; import org.elasticsearch.common.time.DateFormatter; -import org.elasticsearch.plugins.MapperPlugin; import static org.elasticsearch.index.mapper.ObjectMapper.Dynamic; @@ -18,7 +17,6 @@ * Plugins that provide runtime field implementations can also plug in their implementation of this interface * to define how leaf fields of each supported type can be dynamically created in dynamic runtime mode. * - * @see MapperPlugin#getDynamicRuntimeFieldsBuilder() * @see Dynamic */ public interface DynamicRuntimeFieldsBuilder { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java b/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java index 6ca146bfd5afc..e8c073562ce1e 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java @@ -49,7 +49,6 @@ class ParserContext { private final Function similarityLookupService; private final Function typeParsers; private final Function runtimeTypeParsers; - private final boolean supportsDynamicRuntimeMappings; private final Version indexVersionCreated; private final Supplier searchExecutionContextSupplier; private final DateFormatter dateFormatter; @@ -67,8 +66,7 @@ public ParserContext(Function similarityLookupServic ScriptService scriptService, IndexAnalyzers indexAnalyzers, IndexSettings indexSettings, - BooleanSupplier idFieldDataEnabled, - boolean supportsDynamicRuntimeMappings) { + BooleanSupplier idFieldDataEnabled) { this.similarityLookupService = similarityLookupService; this.typeParsers = typeParsers; this.runtimeTypeParsers = runtimeTypeParsers; @@ -79,7 +77,6 @@ public ParserContext(Function similarityLookupServic this.indexAnalyzers = indexAnalyzers; this.indexSettings = indexSettings; this.idFieldDataEnabled = idFieldDataEnabled; - this.supportsDynamicRuntimeMappings = supportsDynamicRuntimeMappings; } public IndexAnalyzers getIndexAnalyzers() { @@ -110,10 +107,6 @@ public RuntimeFieldType.Parser runtimeFieldTypeParser(String type) { return runtimeTypeParsers.apply(type); } - public boolean supportsDynamicRuntimeMappings() { - return supportsDynamicRuntimeMappings; - } - public Version indexVersionCreated() { return indexVersionCreated; } @@ -159,7 +152,7 @@ private static class MultiFieldParserContext extends ParserContext { MultiFieldParserContext(ParserContext in) { super(in.similarityLookupService, in.typeParsers, in.runtimeTypeParsers, in.indexVersionCreated, in.searchExecutionContextSupplier, in.dateFormatter, in.scriptService, in.indexAnalyzers, in.indexSettings, - in.idFieldDataEnabled, in.supportsDynamicRuntimeMappings); + in.idFieldDataEnabled); } @Override @@ -170,7 +163,7 @@ private static class DynamicTemplateParserContext extends ParserContext { DynamicTemplateParserContext(ParserContext in) { super(in.similarityLookupService, in.typeParsers, in.runtimeTypeParsers, in.indexVersionCreated, in.searchExecutionContextSupplier, in.dateFormatter, in.scriptService, in.indexAnalyzers, in.indexSettings, - in.idFieldDataEnabled, in.supportsDynamicRuntimeMappings); + in.idFieldDataEnabled); } @Override diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java index d4da272567971..8ca8b238340c6 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -110,8 +110,8 @@ public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function parserContextFunction = dateFormatter -> new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperRegistry.getMapperParsers()::get, mapperRegistry.getRuntimeFieldTypeParsers()::get, indexVersionCreated, searchExecutionContextSupplier, dateFormatter, - scriptService, indexAnalyzers, indexSettings, idFieldDataEnabled, mapperRegistry.getDynamicRuntimeFieldsBuilder() != null); - this.documentParser = new DocumentParser(xContentRegistry, parserContextFunction, mapperRegistry.getDynamicRuntimeFieldsBuilder()); + scriptService, indexAnalyzers, indexSettings, idFieldDataEnabled); + this.documentParser = new DocumentParser(xContentRegistry, parserContextFunction); Map metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(indexSettings.getIndexVersionCreated()); this.parserContextSupplier = () -> parserContextFunction.apply(null); diff --git a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java index 18f3e0d53ab20..0b802eaba9486 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java @@ -219,10 +219,6 @@ protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, O if (value.equalsIgnoreCase("strict")) { builder.dynamic(Dynamic.STRICT); } else if (value.equalsIgnoreCase("runtime")) { - if (parserContext.supportsDynamicRuntimeMappings() == false) { - throw new IllegalArgumentException("unable to set dynamic:runtime as there is " + - "no registered dynamic runtime fields builder"); - } builder.dynamic(Dynamic.RUNTIME); } else { boolean dynamic = XContentMapValues.nodeBooleanValue(fieldNode, fieldName + ".dynamic"); diff --git a/server/src/main/java/org/elasticsearch/index/mapper/ParseContext.java b/server/src/main/java/org/elasticsearch/index/mapper/ParseContext.java index 4f6f28b2ac212..5628c2a4816d0 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/ParseContext.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/ParseContext.java @@ -15,7 +15,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.analysis.IndexAnalyzers; -import org.elasticsearch.plugins.MapperPlugin; import java.util.ArrayList; import java.util.Collection; @@ -685,7 +684,6 @@ public final T parseExternalValue(Class clazz) { /** * Retrieve the builder for dynamically created runtime fields - * @see MapperPlugin#getDynamicRuntimeFieldsBuilder() */ public abstract DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder(); } diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesModule.java b/server/src/main/java/org/elasticsearch/indices/IndicesModule.java index c090a8a2163f8..ceada54d84b6e 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesModule.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesModule.java @@ -23,7 +23,6 @@ import org.elasticsearch.index.mapper.CompletionFieldMapper; import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.index.mapper.DocCountFieldMapper; -import org.elasticsearch.index.mapper.DynamicRuntimeFieldsBuilder; import org.elasticsearch.index.mapper.FieldAliasMapper; import org.elasticsearch.index.mapper.FieldNamesFieldMapper; import org.elasticsearch.index.mapper.GeoPointFieldMapper; @@ -52,6 +51,13 @@ import org.elasticsearch.indices.mapper.MapperRegistry; import org.elasticsearch.indices.store.IndicesStore; import org.elasticsearch.plugins.MapperPlugin; +import org.elasticsearch.runtimefields.mapper.BooleanScriptFieldType; +import org.elasticsearch.runtimefields.mapper.DateScriptFieldType; +import org.elasticsearch.runtimefields.mapper.DoubleScriptFieldType; +import org.elasticsearch.runtimefields.mapper.GeoPointScriptFieldType; +import org.elasticsearch.runtimefields.mapper.IpScriptFieldType; +import org.elasticsearch.runtimefields.mapper.KeywordScriptFieldType; +import org.elasticsearch.runtimefields.mapper.LongScriptFieldType; import java.util.Arrays; import java.util.Collections; @@ -70,7 +76,7 @@ public class IndicesModule extends AbstractModule { public IndicesModule(List mapperPlugins) { this.mapperRegistry = new MapperRegistry(getMappers(mapperPlugins), getRuntimeFieldTypes(mapperPlugins), - getDynamicRuntimeFieldsBuilder(mapperPlugins), getMetadataMappers(mapperPlugins), getFieldFilter(mapperPlugins)); + getMetadataMappers(mapperPlugins), getFieldFilter(mapperPlugins)); } public static List getNamedWriteables() { @@ -132,6 +138,14 @@ public static Map getMappers(List mappe private static Map getRuntimeFieldTypes(List mapperPlugins) { Map runtimeParsers = new LinkedHashMap<>(); + runtimeParsers.put(BooleanFieldMapper.CONTENT_TYPE, BooleanScriptFieldType.PARSER); + runtimeParsers.put(NumberFieldMapper.NumberType.LONG.typeName(), LongScriptFieldType.PARSER); + runtimeParsers.put(NumberFieldMapper.NumberType.DOUBLE.typeName(), DoubleScriptFieldType.PARSER); + runtimeParsers.put(IpFieldMapper.CONTENT_TYPE, IpScriptFieldType.PARSER); + runtimeParsers.put(DateFieldMapper.CONTENT_TYPE, DateScriptFieldType.PARSER); + runtimeParsers.put(KeywordFieldMapper.CONTENT_TYPE, KeywordScriptFieldType.PARSER); + runtimeParsers.put(GeoPointFieldMapper.CONTENT_TYPE, GeoPointScriptFieldType.PARSER); + for (MapperPlugin mapperPlugin : mapperPlugins) { for (Map.Entry entry : mapperPlugin.getRuntimeFieldTypes().entrySet()) { if (runtimeParsers.put(entry.getKey(), entry.getValue()) != null) { @@ -142,19 +156,6 @@ private static Map getRuntimeFieldTypes(List mapperPlugins) { - DynamicRuntimeFieldsBuilder dynamicRuntimeFieldsBuilder = null; - for (MapperPlugin mapperPlugin : mapperPlugins) { - if (mapperPlugin.getDynamicRuntimeFieldsBuilder() != null) { - if (dynamicRuntimeFieldsBuilder != null) { - throw new IllegalArgumentException("Dynamic runtime fields builder already registered"); - } - dynamicRuntimeFieldsBuilder = mapperPlugin.getDynamicRuntimeFieldsBuilder(); - } - } - return dynamicRuntimeFieldsBuilder; - } - private static final Map builtInMetadataMappers = initBuiltInMetadataMappers(); private static final Set builtInMetadataFields = Collections.unmodifiableSet(builtInMetadataMappers.keySet()); diff --git a/server/src/main/java/org/elasticsearch/indices/mapper/MapperRegistry.java b/server/src/main/java/org/elasticsearch/indices/mapper/MapperRegistry.java index 337ef655f9419..ea898c792f2fc 100644 --- a/server/src/main/java/org/elasticsearch/indices/mapper/MapperRegistry.java +++ b/server/src/main/java/org/elasticsearch/indices/mapper/MapperRegistry.java @@ -9,7 +9,6 @@ package org.elasticsearch.indices.mapper; import org.elasticsearch.Version; -import org.elasticsearch.index.mapper.DynamicRuntimeFieldsBuilder; import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.index.mapper.MetadataFieldMapper; import org.elasticsearch.index.mapper.NestedPathFieldMapper; @@ -29,19 +28,16 @@ public final class MapperRegistry { private final Map mapperParsers; private final Map runtimeFieldTypeParsers; - private final DynamicRuntimeFieldsBuilder dynamicRuntimeFieldsBuilder; private final Map metadataMapperParsers; private final Map metadataMapperParsers7x; private final Function> fieldFilter; public MapperRegistry(Map mapperParsers, Map runtimeFieldTypeParsers, - DynamicRuntimeFieldsBuilder dynamicRuntimeFieldsBuilder, Map metadataMapperParsers, Function> fieldFilter) { this.mapperParsers = Collections.unmodifiableMap(new LinkedHashMap<>(mapperParsers)); this.runtimeFieldTypeParsers = runtimeFieldTypeParsers; - this.dynamicRuntimeFieldsBuilder = dynamicRuntimeFieldsBuilder; this.metadataMapperParsers = Collections.unmodifiableMap(new LinkedHashMap<>(metadataMapperParsers)); Map metadata7x = new LinkedHashMap<>(metadataMapperParsers); metadata7x.remove(NestedPathFieldMapper.NAME); @@ -61,10 +57,6 @@ public Map getRuntimeFieldTypeParsers() { return runtimeFieldTypeParsers; } - public DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder() { - return dynamicRuntimeFieldsBuilder; - } - /** * Return a map of the meta mappers that have been registered. The * returned map uses the name of the field as a key. diff --git a/server/src/main/java/org/elasticsearch/plugins/MapperPlugin.java b/server/src/main/java/org/elasticsearch/plugins/MapperPlugin.java index 6308a92bec149..e4cf5c3456731 100644 --- a/server/src/main/java/org/elasticsearch/plugins/MapperPlugin.java +++ b/server/src/main/java/org/elasticsearch/plugins/MapperPlugin.java @@ -8,7 +8,6 @@ package org.elasticsearch.plugins; -import org.elasticsearch.index.mapper.DynamicRuntimeFieldsBuilder; import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.index.mapper.MetadataFieldMapper; import org.elasticsearch.index.mapper.RuntimeFieldType; @@ -45,14 +44,6 @@ default Map getRuntimeFieldTypes() { return Collections.emptyMap(); } - /** - * Defines how runtime fields are dynamically created when objects are mapped with dynamic:runtime. - * @see DynamicRuntimeFieldsBuilder - */ - default DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder() { - return null; - } - /** * Returns additional metadata mapper implementations added by this plugin. *

diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BinaryScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BinaryScriptFieldData.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BinaryScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/BinaryScriptFieldData.java index f6a07d17b8846..9fc2d7acdba17 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BinaryScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BinaryScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.SortField; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptDocValues.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptDocValues.java index 5d9f5d6c9d0f6..4b94d29595c21 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptDocValues.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.elasticsearch.index.fielddata.AbstractSortedNumericDocValues; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; public final class BooleanScriptDocValues extends AbstractSortedNumericDocValues { private final BooleanFieldScript script; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptFieldData.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptFieldData.java index 61f5007df6bd3..b601a34e879d2 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/BooleanScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/BooleanScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.SortedNumericDocValues; @@ -15,9 +16,9 @@ import org.elasticsearch.index.fielddata.IndexNumericFieldData; import org.elasticsearch.index.fielddata.plain.LeafLongFieldData; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; public final class BooleanScriptFieldData extends IndexNumericFieldData { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DateScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DateScriptFieldData.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DateScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/DateScriptFieldData.java index 8b63e0e47db9b..f530083e8c3e6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DateScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DateScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.SortedNumericDocValues; @@ -15,9 +16,9 @@ import org.elasticsearch.index.fielddata.IndexNumericFieldData; import org.elasticsearch.index.fielddata.plain.LeafLongFieldData; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; public final class DateScriptFieldData extends IndexNumericFieldData { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptDocValues.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptDocValues.java index 06c280c6f37b7..0fccc46052caa 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptDocValues.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import java.util.Arrays; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptFieldData.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptFieldData.java index 893c02890df2a..5c9887e6db2d3 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/DoubleScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/DoubleScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.ExceptionsHelper; @@ -15,9 +16,9 @@ import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.index.fielddata.plain.LeafDoubleFieldData; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; public final class DoubleScriptFieldData extends IndexNumericFieldData { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptDocValues.java similarity index 81% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptDocValues.java index e41d02548a1a2..16b6f2f2ce40a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptDocValues.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.geo.GeoEncodingUtils; import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.index.fielddata.MultiGeoPointValues; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import java.util.Arrays; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptFieldData.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptFieldData.java index 34a2c570573d6..9d1fee30d0f5f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/GeoPointScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/GeoPointScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.SortField; @@ -17,13 +18,13 @@ import org.elasticsearch.index.fielddata.MultiGeoPointValues; import org.elasticsearch.index.fielddata.plain.AbstractLeafGeoPointFieldData; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; import org.elasticsearch.search.sort.BucketedSort; import org.elasticsearch.search.sort.SortOrder; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; public class GeoPointScriptFieldData implements IndexGeoPointFieldData { public static class Builder implements IndexFieldData.Builder { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptDocValues.java similarity index 76% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptDocValues.java index 21c4d83aa07f8..370ece76c484d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptDocValues.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.util.BytesRef; import org.elasticsearch.index.fielddata.SortedBinaryDocValues; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import java.util.Arrays; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptFieldData.java similarity index 88% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptFieldData.java index 8860584bd573d..e41a9c4083ea7 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/IpScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/IpScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.index.LeafReaderContext; @@ -19,9 +20,9 @@ import org.elasticsearch.index.fielddata.SortedBinaryDocValues; import org.elasticsearch.index.mapper.IpFieldMapper; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; @@ -59,7 +60,7 @@ public ScriptDocValues getScriptValues() { @Override public SortedBinaryDocValues getBytesValues() { - return new org.elasticsearch.xpack.runtimefields.fielddata.IpScriptDocValues(script); + return new org.elasticsearch.runtimefields.fielddata.IpScriptDocValues(script); } }; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptDocValues.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptDocValues.java index 9cec6d5a263bf..8cd20493910cf 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptDocValues.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.elasticsearch.index.fielddata.AbstractSortedNumericDocValues; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import java.util.Arrays; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptFieldData.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptFieldData.java index cca70e50a3a37..53dd9932d5395 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/LongScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/LongScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.SortedNumericDocValues; @@ -15,9 +16,9 @@ import org.elasticsearch.index.fielddata.IndexNumericFieldData; import org.elasticsearch.index.fielddata.plain.LeafLongFieldData; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.LongFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript; import java.io.IOException; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptDocValues.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptDocValues.java similarity index 73% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptDocValues.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptDocValues.java index 4c5efadbe361b..1f60b4918e781 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptDocValues.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptDocValues.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.elasticsearch.index.fielddata.SortingBinaryDocValues; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptFieldData.java b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptFieldData.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptFieldData.java rename to server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptFieldData.java index aa53287878756..3ae258164d003 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/StringScriptFieldData.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/fielddata/StringScriptFieldData.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.fielddata; +package org.elasticsearch.runtimefields.fielddata; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.index.fielddata.IndexFieldData; @@ -13,9 +14,9 @@ import org.elasticsearch.index.fielddata.ScriptDocValues; import org.elasticsearch.index.fielddata.SortedBinaryDocValues; import org.elasticsearch.indices.breaker.CircuitBreakerService; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; public class StringScriptFieldData extends BinaryScriptFieldData { public static class Builder implements IndexFieldData.Builder { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractFieldScript.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractFieldScript.java index 9607916a4b783..72165c8a3ca65 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.xcontent.support.XContentMapValues; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractLongFieldScript.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractLongFieldScript.java index 8d153a7940982..ab4e30ea9914f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractLongFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.util.ArrayUtil; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldType.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldType.java index a16db46806025..0b04974b08ec6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.search.MultiTermQuery; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScript.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScript.java index d79fe285bb449..f83f67a281acf 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.Booleans; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldType.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldType.java index 8fd3f16420e39..8ef457b2a5d9c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.search.MatchNoDocsQuery; import org.apache.lucene.search.Query; @@ -19,12 +20,12 @@ import org.elasticsearch.index.mapper.BooleanFieldMapper; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.BooleanScriptFieldData; +import org.elasticsearch.runtimefields.query.BooleanScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.BooleanScriptFieldTermQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.BooleanScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.BooleanScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.BooleanScriptFieldTermQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DateFieldScript.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/DateFieldScript.java index 5cfcce25a48c0..f0683d094c1ab 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DateFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.time.DateFormatter; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldType.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldType.java index a07b581450334..a002be966f14e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; @@ -24,15 +25,15 @@ import org.elasticsearch.index.mapper.FieldMapper; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.DateScriptFieldData; +import org.elasticsearch.runtimefields.query.LongScriptFieldDistanceFeatureQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldRangeQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldTermQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldTermsQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.DateScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldDistanceFeatureQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldRangeQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldTermQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldTermsQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScript.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScript.java index c2e64c87c8563..5187e7a35d85a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.util.ArrayUtil; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldType.java similarity index 88% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldType.java index 885ae743d0a4c..75d84436bd7eb 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; @@ -17,14 +18,14 @@ import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.DoubleScriptFieldData; +import org.elasticsearch.runtimefields.query.DoubleScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.DoubleScriptFieldRangeQuery; +import org.elasticsearch.runtimefields.query.DoubleScriptFieldTermQuery; +import org.elasticsearch.runtimefields.query.DoubleScriptFieldTermsQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.DoubleScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldRangeQuery; -import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldTermQuery; -import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldTermsQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java similarity index 84% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java index d7ad87609a675..f74a70e523e1e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeFieldsBuilder.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.index.mapper.RuntimeFieldType; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScript.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScript.java index ed022b760671e..73931ea99eea1 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.LatLonDocValuesField; import org.apache.lucene.index.LeafReaderContext; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldType.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldType.java index 7f1ae78801423..16d73c0d1822c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.geo.LatLonGeometry; import org.apache.lucene.geo.Point; @@ -24,12 +25,12 @@ import org.elasticsearch.index.mapper.GeoShapeQueryable; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.GeoPointScriptFieldData; +import org.elasticsearch.runtimefields.query.GeoPointScriptFieldDistanceFeatureQuery; +import org.elasticsearch.runtimefields.query.GeoPointScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.GeoPointScriptFieldGeoShapeQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.GeoPointScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.GeoPointScriptFieldDistanceFeatureQuery; -import org.elasticsearch.xpack.runtimefields.query.GeoPointScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.GeoPointScriptFieldGeoShapeQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/IpFieldScript.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/IpFieldScript.java index deaa2e74864a5..81fe0b77eb29c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/IpFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.index.LeafReaderContext; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldType.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldType.java index 4317790954526..13a8a88f4589c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.search.BooleanClause.Occur; @@ -23,14 +24,14 @@ import org.elasticsearch.index.mapper.IpFieldMapper; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.IpScriptFieldData; +import org.elasticsearch.runtimefields.query.IpScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.IpScriptFieldRangeQuery; +import org.elasticsearch.runtimefields.query.IpScriptFieldTermQuery; +import org.elasticsearch.runtimefields.query.IpScriptFieldTermsQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.IpScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldRangeQuery; -import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldTermQuery; -import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldTermsQuery; import java.io.IOException; import java.net.InetAddress; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldType.java similarity index 88% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldType.java index ffe9dab983a55..d7e2a5dd85945 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.search.MultiTermQuery.RewriteMethod; import org.apache.lucene.search.Query; @@ -18,17 +19,17 @@ import org.elasticsearch.index.mapper.KeywordFieldMapper; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.StringScriptFieldData; +import org.elasticsearch.runtimefields.query.StringScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldFuzzyQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldPrefixQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldRangeQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldRegexpQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldTermQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldTermsQuery; +import org.elasticsearch.runtimefields.query.StringScriptFieldWildcardQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.StringScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldFuzzyQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldPrefixQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldRangeQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldRegexpQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldTermQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldTermsQuery; -import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldWildcardQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/LongFieldScript.java similarity index 89% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/LongFieldScript.java index 81bf4c2bf614b..84c09c54cfe38 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/LongFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.index.mapper.NumberFieldMapper; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldType.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldType.java similarity index 89% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldType.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldType.java index 65d43723cfcc1..73d7a5fc01503 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldType.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldType.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; @@ -17,14 +18,14 @@ import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType; import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.query.SearchExecutionContext; +import org.elasticsearch.runtimefields.fielddata.LongScriptFieldData; +import org.elasticsearch.runtimefields.query.LongScriptFieldExistsQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldRangeQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldTermQuery; +import org.elasticsearch.runtimefields.query.LongScriptFieldTermsQuery; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.fielddata.LongScriptFieldData; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldExistsQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldRangeQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldTermQuery; -import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldTermsQuery; import java.io.IOException; import java.time.ZoneId; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java b/server/src/main/java/org/elasticsearch/runtimefields/mapper/StringFieldScript.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java rename to server/src/main/java/org/elasticsearch/runtimefields/mapper/StringFieldScript.java index c61fdc7996f2c..42eb28ebba42c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/mapper/StringFieldScript.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.script.ScriptContext; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQuery.java similarity index 78% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQuery.java index 8b00c3e8980f8..5dee60be29a53 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.QueryVisitor; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; /** * Abstract base class for building queries based on {@link DoubleFieldScript}. diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQuery.java similarity index 79% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQuery.java index 5fc3caabe4982..f5c85a2b51e30 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQuery.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.QueryVisitor; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; /** * Abstract base class for building queries based on {@link DoubleFieldScript}. diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQuery.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQuery.java index a3764f148f287..ec14317b79c4a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; /** * Abstract base class for building queries based on {@link GeoPointFieldScript}. diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQuery.java similarity index 77% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQuery.java index ff28903d0da00..d9305964a592f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQuery.java @@ -1,19 +1,20 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.net.InetAddress; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQuery.java similarity index 81% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQuery.java index aaf137ee5ece6..cd77d06b50249 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.QueryVisitor; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQuery.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQuery.java index 5a9898ea64c34..af4fd81f0dd97 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQuery.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.ConstantScoreScorer; @@ -18,8 +19,8 @@ import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; +import org.elasticsearch.runtimefields.mapper.AbstractFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractFieldScript; import java.io.IOException; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java similarity index 82% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java index 2fb73ed436b15..6720f139ad07d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java @@ -1,17 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.automaton.ByteRunAutomaton; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQuery.java similarity index 74% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQuery.java index a3e954a0fde67..0512823210c49 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQuery.java similarity index 74% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQuery.java index ba111dc4ebc0a..80c200ae34e53 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; public class BooleanScriptFieldExistsQuery extends AbstractBooleanScriptFieldQuery { public BooleanScriptFieldExistsQuery(Script script, BooleanFieldScript.LeafFactory leafFactory, String fieldName) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQuery.java similarity index 81% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQuery.java index 23bd3fb307428..cba184678f855 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQuery.java similarity index 74% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQuery.java index 1be31bde40c42..c4b80a26640c2 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; public class DoubleScriptFieldExistsQuery extends AbstractDoubleScriptFieldQuery { public DoubleScriptFieldExistsQuery(Script script, DoubleFieldScript.LeafFactory leafFactory, String fieldName) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQuery.java similarity index 86% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQuery.java index b90a7a2424f19..0c3e3b653a0a6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQuery.java similarity index 82% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQuery.java index 8a2485936d6dd..a685768457244 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQuery.java similarity index 86% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQuery.java index 41ce19d0dda48..8c669c92dfa41 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQuery.java @@ -1,17 +1,17 @@ -/* /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import com.carrotsearch.hppc.LongSet; import com.carrotsearch.hppc.cursors.LongCursor; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Arrays; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java similarity index 96% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java index 4829833127812..9d4b20c7af5e4 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQuery.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.geo.GeoEncodingUtils; import org.apache.lucene.geo.GeoUtils; @@ -20,8 +21,8 @@ import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; import org.apache.lucene.util.SloppyMath; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.io.IOException; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQuery.java similarity index 74% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQuery.java index 11ae1b2e50bff..0947d7cc53a51 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; public class GeoPointScriptFieldExistsQuery extends AbstractGeoPointScriptFieldQuery { public GeoPointScriptFieldExistsQuery(Script script, GeoPointFieldScript.LeafFactory leafFactory, String fieldName) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java index 03c8edcda4631..0d929bee30ad0 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQuery.java @@ -1,18 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.geo.Component2D; import org.apache.lucene.geo.GeoEncodingUtils; import org.apache.lucene.geo.LatLonGeometry; import org.elasticsearch.common.geo.ShapeRelation; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; import java.util.Arrays; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQuery.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQuery.java index d8f052eea2a06..8db71c21fc5cf 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQuery.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; public class IpScriptFieldExistsQuery extends AbstractIpScriptFieldQuery { public IpScriptFieldExistsQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQuery.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQuery.java index 371d3815cb606..f4ed9a6848a80 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQuery.java similarity index 84% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQuery.java index 4b7282a9c5b5e..ff921f6f1a267 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQuery.java similarity index 89% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQuery.java index ceabc23203cd3..343d29ed2967a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQuery.java @@ -1,17 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.common.util.BytesRefHash; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java index 3efafafbf60d8..e1eb0ff645b3e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term; @@ -17,8 +18,8 @@ import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.io.IOException; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQuery.java similarity index 76% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQuery.java index 3ecda862e896b..065f66f5ed65c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQuery.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQuery.java similarity index 86% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQuery.java index aac133fc87e7e..1a76754e790d0 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQuery.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQuery.java similarity index 83% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQuery.java index ce27f92c3c026..aef02549c225d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQuery.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQuery.java similarity index 83% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQuery.java index cc1bdb6ba0381..4410d40feb724 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import com.carrotsearch.hppc.LongSet; import org.apache.lucene.index.LeafReaderContext; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQuery.java similarity index 75% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQuery.java index f9799d5ce6c91..28724f697c5fe 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQuery.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQuery.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQuery.java index 34d8b3b9257b3..fa4c8d5d794f1 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQuery.java @@ -1,17 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.FuzzyQuery; import org.apache.lucene.util.automaton.ByteRunAutomaton; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQuery.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQuery.java index 04caf6bfc6d58..25a35d23b718d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQuery.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.QueryVisitor; @@ -13,8 +14,8 @@ import org.apache.lucene.util.automaton.Automaton; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.common.lucene.search.AutomatonQueries; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQuery.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQuery.java index 032ddfedcb66a..e455e2b080b3f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQuery.java @@ -1,18 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.Automata; import org.apache.lucene.util.automaton.ByteRunAutomaton; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQuery.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQuery.java index fba79b5f38a0f..0eb39bbafd996 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.apache.lucene.util.automaton.RegExp; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQuery.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQuery.java index 7096fbae6c437..066ca4d063b36 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.QueryVisitor; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQuery.java similarity index 85% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQuery.java index c2a867b909533..6fff6d879eb2a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQuery.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.QueryVisitor; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQuery.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java rename to server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQuery.java index 069124795f397..72e52c8565f8a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java +++ b/server/src/main/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQuery.java @@ -1,19 +1,20 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.automaton.Automaton; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.common.lucene.search.AutomatonQueries; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; diff --git a/server/src/main/java/org/elasticsearch/script/ScriptModule.java b/server/src/main/java/org/elasticsearch/script/ScriptModule.java index f47246e278f3d..8485ecd722e30 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptModule.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptModule.java @@ -12,6 +12,13 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.IntervalFilterScript; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.LongFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.search.aggregations.pipeline.MovingFunctionScript; import java.util.Collections; @@ -51,7 +58,14 @@ public class ScriptModule { ScriptedMetricAggContexts.MapScript.CONTEXT, ScriptedMetricAggContexts.CombineScript.CONTEXT, ScriptedMetricAggContexts.ReduceScript.CONTEXT, - IntervalFilterScript.CONTEXT + IntervalFilterScript.CONTEXT, + BooleanFieldScript.CONTEXT, + DateFieldScript.CONTEXT, + DoubleFieldScript.CONTEXT, + GeoPointFieldScript.CONTEXT, + IpFieldScript.CONTEXT, + LongFieldScript.CONTEXT, + StringFieldScript.CONTEXT ).collect(Collectors.toMap(c -> c.name, Function.identity())); } diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifierTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifierTests.java index 8248c1379cd88..4c64a3879ef99 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifierTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifierTests.java @@ -83,7 +83,7 @@ private IndexMetadataVerifier getIndexMetadataVerifier() { return new IndexMetadataVerifier( Settings.EMPTY, xContentRegistry(), - new MapperRegistry(Collections.emptyMap(), Collections.emptyMap(), null, Collections.emptyMap(), + new MapperRegistry(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), MapperPlugin.NOOP_FIELD_FILTER), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, null ); diff --git a/server/src/test/java/org/elasticsearch/index/codec/CodecTests.java b/server/src/test/java/org/elasticsearch/index/codec/CodecTests.java index 004f9531de006..5939e6fbf72d2 100644 --- a/server/src/test/java/org/elasticsearch/index/codec/CodecTests.java +++ b/server/src/test/java/org/elasticsearch/index/codec/CodecTests.java @@ -105,7 +105,7 @@ private CodecService createCodecService() throws IOException { IndexSettings settings = IndexSettingsModule.newIndexSettings("_na", nodeSettings); SimilarityService similarityService = new SimilarityService(settings, null, Collections.emptyMap()); IndexAnalyzers indexAnalyzers = createTestAnalysis(settings, nodeSettings).indexAnalyzers; - MapperRegistry mapperRegistry = new MapperRegistry(Collections.emptyMap(), Collections.emptyMap(), null, Collections.emptyMap(), + MapperRegistry mapperRegistry = new MapperRegistry(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), MapperPlugin.NOOP_FIELD_FILTER); MapperService service = new MapperService(settings, indexAnalyzers, xContentRegistry(), similarityService, mapperRegistry, () -> null, () -> false, null); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java index 6f6d62f6683fa..c6b005c9546be 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java @@ -8,24 +8,6 @@ package org.elasticsearch.index.mapper; -import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; -import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; - -import java.io.IOException; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; import org.apache.lucene.index.IndexableField; @@ -42,11 +24,29 @@ import org.elasticsearch.plugins.MapperPlugin; import org.elasticsearch.plugins.Plugin; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; +import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; + public class DocumentParserTests extends MapperServiceTestCase { @Override protected Collection getPlugins() { - return List.of(new DocumentParserTestsPlugin(), new TestRuntimeField.Plugin()); + return List.of(new DocumentParserTestsPlugin()); } public void testParseWithRuntimeField() throws Exception { diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java index ddcb5d0f7cafa..d0dd94f142f3e 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java @@ -12,12 +12,9 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.plugins.Plugin; import java.io.IOException; import java.time.Instant; -import java.util.Collection; -import java.util.Collections; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -27,11 +24,6 @@ public class DynamicMappingTests extends MapperServiceTestCase { - @Override - protected Collection getPlugins() { - return Collections.singletonList(new TestRuntimeField.Plugin()); - } - private XContentBuilder dynamicMapping(String dynamicValue, CheckedConsumer buildFields) throws IOException { return topMapping(b -> { diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java index 80e0068d0e60d..0b0603d40469d 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java @@ -11,11 +11,9 @@ import org.apache.lucene.index.IndexOptions; import org.apache.lucene.index.IndexableField; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.mapper.ParseContext.Document; import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -52,60 +50,6 @@ public void testMatchTypeOnly() throws Exception { assertTrue(mapperService.fieldType("l").isSearchable()); } - public void testMatchTypeRuntimeNoPlugin() throws Exception { - XContentBuilder topMapping = topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - { - b.startObject("test"); - { - b.field("match_mapping_type", "string"); - b.startObject("runtime").endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endArray(); - }); - - MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(topMapping)); - assertEquals("Failed to parse mapping: dynamic template [test] has invalid content [" + - "{\"match_mapping_type\":\"string\",\"runtime\":{}}], " + - "attempted to validate it with the following match_mapping_type: [string]", e.getMessage()); - assertEquals("No runtime field found for type [keyword]", e.getRootCause().getMessage()); - } - - public void testMatchAllTypesRuntimeNoPlugin() throws Exception { - XContentBuilder topMapping = topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - { - b.startObject("test"); - { - if (randomBoolean()) { - b.field("match_mapping_type", "*"); - } else { - b.field("match", "field"); - } - b.startObject("runtime").endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endArray(); - }); - - MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(topMapping)); - assertThat(e.getMessage(), containsString("Failed to parse mapping: dynamic template [test] has invalid content [")); - assertThat(e.getMessage(), containsString("attempted to validate it with the following match_mapping_type: " + - "[string, long, double, boolean, date]")); - assertEquals("No runtime field found for type [date]", e.getRootCause().getMessage()); - } - public void testSimple() throws Exception { String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json"); MapperService mapperService = createMapperService(mapping); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java b/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java index d4711b783f2ef..885ea2c15287a 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/MappingParserTests.java @@ -39,7 +39,7 @@ private static MappingParser createMappingParser(Settings settings) { () -> new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperRegistry.getMapperParsers()::get, mapperRegistry.getRuntimeFieldTypeParsers()::get, indexSettings.getIndexVersionCreated(), () -> { throw new UnsupportedOperationException(); }, null, - scriptService, indexAnalyzers, indexSettings, () -> false, mapperRegistry.getDynamicRuntimeFieldsBuilder() != null); + scriptService, indexAnalyzers, indexSettings, () -> false); Map metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(indexSettings.getIndexVersionCreated()); Map, MetadataFieldMapper> metadataMappers = new LinkedHashMap<>(); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java index 7918134e328c8..57fea94a8821a 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/ParametrizedMapperTests.java @@ -205,7 +205,7 @@ private static TestMapper fromMapping(String mapping, Version version, boolean f }, name -> null, version, () -> null, null, null, mapperService.getIndexAnalyzers(), mapperService.getIndexSettings(), () -> { throw new UnsupportedOperationException(); - }, false); + }); if (fromDynamicTemplate) { pc = pc.createDynamicTemplateFieldContext(pc); } diff --git a/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java index 493b2d012d961..2f646ec60abb7 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java @@ -8,7 +8,6 @@ package org.elasticsearch.index.mapper; -import org.apache.lucene.search.Query; import org.elasticsearch.Version; import org.elasticsearch.common.Strings; import org.elasticsearch.common.compress.CompressedXContent; @@ -16,15 +15,13 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.MapperService.MergeReason; -import org.elasticsearch.index.query.SearchExecutionContext; -import org.elasticsearch.plugins.MapperPlugin; -import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.runtimefields.mapper.DoubleScriptFieldType; +import org.elasticsearch.runtimefields.mapper.KeywordScriptFieldType; +import org.elasticsearch.runtimefields.mapper.LongScriptFieldType; import java.io.IOException; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; -import java.util.Map; import static org.elasticsearch.test.VersionUtils.randomVersionBetween; import static org.hamcrest.Matchers.containsString; @@ -363,7 +360,7 @@ public void testIllegalDynamicTemplateUnknownAttributeRuntime() throws Exception mapping.startObject("my_template"); mapping.field("match_mapping_type", "string"); mapping.startObject("runtime"); - mapping.field("type", "test"); + mapping.field("type", "keyword"); mapping.field("foo", "bar"); mapping.endObject(); mapping.endObject(); @@ -376,9 +373,9 @@ public void testIllegalDynamicTemplateUnknownAttributeRuntime() throws Exception MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(mapping)); assertEquals("Failed to parse mapping: dynamic template [my_template] has invalid content [" + - "{\"match_mapping_type\":\"string\",\"runtime\":{\"foo\":\"bar\",\"type\":\"test\"}}], " + + "{\"match_mapping_type\":\"string\",\"runtime\":{\"foo\":\"bar\",\"type\":\"keyword\"}}], " + "attempted to validate it with the following match_mapping_type: [string]", e.getMessage()); - assertEquals("Unknown mapping attributes [{foo=bar}]", e.getRootCause().getMessage()); + assertEquals("unknown parameter [foo] on mapper [__dynamic__my_template] of type [keyword]", e.getRootCause().getMessage()); } public void testIllegalDynamicTemplateInvalidAttribute() throws Exception { @@ -499,7 +496,7 @@ public void testIllegalDynamicTemplateNoMappingTypeRuntime() throws Exception { assertThat(e.getMessage(), containsString("Failed to parse mapping: dynamic template [my_template] has invalid content [")); assertThat(e.getMessage(), containsString("attempted to validate it with the following match_mapping_type: " + "[string, long, double, boolean, date]")); - assertEquals("Unknown mapping attributes [{foo=bar}]", e.getRootCause().getMessage()); + assertEquals("unknown parameter [foo] on mapper [__dynamic__my_template] of type [date]", e.getRootCause().getMessage()); } public void testIllegalDynamicTemplate7DotXIndex() throws Exception { @@ -530,16 +527,11 @@ public void testIllegalDynamicTemplate7DotXIndex() throws Exception { "last error: [No mapper found for type [string]]"); } - @Override - protected Collection getPlugins() { - return Collections.singletonList(new RuntimeFieldPlugin()); - } - public void testRuntimeSection() throws IOException { String mapping = Strings.toString(runtimeMapping(builder -> { - builder.startObject("field1").field("type", "test").field("prop1", "value1").endObject(); - builder.startObject("field2").field("type", "test").field("prop2", "value2").endObject(); - builder.startObject("field3").field("type", "test").endObject(); + builder.startObject("field1").field("type", "double").endObject(); + builder.startObject("field2").field("type", "date").endObject(); + builder.startObject("field3").field("type", "ip").endObject(); })); MapperService mapperService = createMapperService(mapping); assertEquals(mapping, mapperService.documentMapper().mappingSource().toString()); @@ -550,7 +542,7 @@ public void testRuntimeSectionRejectedUpdate() throws IOException { { XContentBuilder builder = XContentFactory.jsonBuilder().startObject().startObject("_doc"); builder.startObject("runtime"); - builder.startObject("field").field("type", "test").endObject(); + builder.startObject("field").field("type", "long").endObject(); builder.endObject(); builder.startObject("properties"); builder.startObject("concrete").field("type", "keyword").endObject(); @@ -561,12 +553,12 @@ public void testRuntimeSectionRejectedUpdate() throws IOException { MappedFieldType concrete = mapperService.fieldType("concrete"); assertThat(concrete, instanceOf(KeywordFieldMapper.KeywordFieldType.class)); MappedFieldType field = mapperService.fieldType("field"); - assertThat(field, instanceOf(RuntimeField.class)); + assertThat(field, instanceOf(LongScriptFieldType.class)); } { XContentBuilder builder = XContentFactory.jsonBuilder().startObject().startObject("_doc"); builder.startObject("runtime"); - builder.startObject("another_field").field("type", "test").endObject(); + builder.startObject("another_field").field("type", "geo_point").endObject(); builder.endObject(); builder.startObject("properties"); //try changing the type of the existing concrete field, so that merge fails @@ -580,9 +572,9 @@ public void testRuntimeSectionRejectedUpdate() throws IOException { MappedFieldType concrete = mapperService.fieldType("concrete"); assertThat(concrete, instanceOf(KeywordFieldMapper.KeywordFieldType.class)); MappedFieldType field = mapperService.fieldType("field"); - assertThat(field, instanceOf(RuntimeField.class)); + assertThat(field, instanceOf(LongScriptFieldType.class)); assertNull(mapperService.fieldType("another_field")); - assertEquals("{\"_doc\":{\"runtime\":{\"field\":{\"type\":\"test\"}},\"properties\":{\"concrete\":{\"type\":\"keyword\"}}}}", + assertEquals("{\"_doc\":{\"runtime\":{\"field\":{\"type\":\"long\"}},\"properties\":{\"concrete\":{\"type\":\"keyword\"}}}}", Strings.toString(mapperService.documentMapper().mapping().root)); } } @@ -596,53 +588,48 @@ public void testRuntimeSectionMerge() throws IOException { MappedFieldType field = mapperService.fieldType("field"); assertThat(field, instanceOf(KeywordFieldMapper.KeywordFieldType.class)); } + LongScriptFieldType field2; { String mapping = Strings.toString(runtimeMapping(builder -> { - builder.startObject("field").field("type", "test").field("prop1", "first version").endObject(); - builder.startObject("field2").field("type", "test").endObject(); + builder.startObject("field").field("type", "keyword").endObject(); + builder.startObject("field2").field("type", "long").endObject(); })); merge(mapperService, mapping); //field overrides now the concrete field already defined - RuntimeField field = (RuntimeField)mapperService.fieldType("field"); - assertEquals("first version", field.prop1); - assertNull(field.prop2); - RuntimeField field2 = (RuntimeField)mapperService.fieldType("field2"); - assertNull(field2.prop1); - assertNull(field2.prop2); + KeywordScriptFieldType field = (KeywordScriptFieldType)mapperService.fieldType("field"); + assertEquals(KeywordFieldMapper.CONTENT_TYPE, field.typeName()); + field2 = (LongScriptFieldType)mapperService.fieldType("field2"); + assertEquals(NumberFieldMapper.NumberType.LONG.typeName(), field2.typeName()); } { String mapping = Strings.toString(runtimeMapping( //the existing runtime field gets updated - builder -> builder.startObject("field").field("type", "test").field("prop2", "second version").endObject())); + builder -> builder.startObject("field").field("type", "double").endObject())); merge(mapperService, mapping); - RuntimeField field = (RuntimeField)mapperService.fieldType("field"); - assertNull(field.prop1); - assertEquals("second version", field.prop2); - RuntimeField field2 = (RuntimeField)mapperService.fieldType("field2"); - assertNull(field2.prop1); - assertNull(field2.prop2); + DoubleScriptFieldType field = (DoubleScriptFieldType)mapperService.fieldType("field"); + assertEquals(NumberFieldMapper.NumberType.DOUBLE.typeName(), field.typeName()); + LongScriptFieldType field2Updated = (LongScriptFieldType)mapperService.fieldType("field2"); + assertSame(field2, field2Updated); } { String mapping = Strings.toString(mapping(builder -> builder.startObject("concrete").field("type", "keyword").endObject())); merge(mapperService, mapping); - RuntimeField field = (RuntimeField)mapperService.fieldType("field"); - assertNull(field.prop1); - assertEquals("second version", field.prop2); - RuntimeField field2 = (RuntimeField)mapperService.fieldType("field2"); - assertNull(field2.prop1); - assertNull(field2.prop2); + DoubleScriptFieldType field = (DoubleScriptFieldType)mapperService.fieldType("field"); + assertEquals(NumberFieldMapper.NumberType.DOUBLE.typeName(), field.typeName()); + LongScriptFieldType field2Updated = (LongScriptFieldType)mapperService.fieldType("field2"); + assertSame(field2, field2Updated); MappedFieldType concrete = mapperService.fieldType("concrete"); assertThat(concrete, instanceOf(KeywordFieldMapper.KeywordFieldType.class)); } { String mapping = Strings.toString(runtimeMapping( - builder -> builder.startObject("field3").field("type", "test").field("prop1", "value").endObject())); + builder -> builder.startObject("field3").field("type", "date").endObject())); merge(mapperService, mapping); assertEquals("{\"_doc\":" + "{\"runtime\":{" + - "\"field\":{\"type\":\"test\",\"prop2\":\"second version\"}," + - "\"field2\":{\"type\":\"test\"}," + - "\"field3\":{\"type\":\"test\",\"prop1\":\"value\"}}," + + "\"field\":{\"type\":\"double\"}," + + "\"field2\":{\"type\":\"long\"}," + + "\"field3\":{\"type\":\"date\"}}," + "\"properties\":{" + "\"concrete\":{\"type\":\"keyword\"}," + "\"field\":{\"type\":\"keyword\"}}}}", @@ -655,8 +642,8 @@ public void testRuntimeSectionMerge() throws IOException { merge(mapperService, mapping); assertEquals("{\"_doc\":" + "{\"runtime\":{" + - "\"field\":{\"type\":\"test\",\"prop2\":\"second version\"}," + - "\"field2\":{\"type\":\"test\"}}," + + "\"field\":{\"type\":\"double\"}," + + "\"field2\":{\"type\":\"long\"}}," + "\"properties\":{" + "\"concrete\":{\"type\":\"keyword\"}," + "\"field\":{\"type\":\"keyword\"}}}}", @@ -690,75 +677,8 @@ public void testRuntimeSectionWrongFormat() throws IOException { } public void testRuntimeSectionRemainingField() throws IOException { - XContentBuilder mapping = runtimeFieldMapping(builder -> builder.field("type", "test").field("unsupported", "value")); + XContentBuilder mapping = runtimeFieldMapping(builder -> builder.field("type", "keyword").field("unsupported", "value")); MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(mapping)); - assertEquals("Failed to parse mapping: Mapping definition for [field] has unsupported parameters: " + - "[unsupported : value]", e.getMessage()); - } - - public void testDynamicRuntimeNotSupported() { - { - MapperParsingException e = expectThrows(MapperParsingException.class, - () -> createMapperService(topMapping(b -> b.field("dynamic", "runtime")))); - assertEquals("Failed to parse mapping: unable to set dynamic:runtime as there is no registered dynamic runtime fields builder", - e.getMessage()); - } - { - MapperParsingException e = expectThrows(MapperParsingException.class, - () -> createMapperService(mapping(b -> { - b.startObject("object"); - b.field("type", "object").field("dynamic", "runtime"); - b.endObject(); - }))); - assertEquals("Failed to parse mapping: unable to set dynamic:runtime as there is no registered dynamic runtime fields builder", - e.getMessage()); - } - } - - private static class RuntimeFieldPlugin extends Plugin implements MapperPlugin { - @Override - public Map getRuntimeFieldTypes() { - return Map.of("test", (name, node, parserContext) -> { - Object prop1 = node.remove("prop1"); - Object prop2 = node.remove("prop2"); - return new RuntimeField(name, prop1 == null ? null : prop1.toString(), prop2 == null ? null : prop2.toString()); - }, - "keyword", (name, node, parserContext) -> new TestRuntimeField(name, "keyword"), - "boolean", (name, node, parserContext) -> new TestRuntimeField(name, "boolean"), - "long", (name, node, parserContext) -> new TestRuntimeField(name, "long"), - "double", (name, node, parserContext) -> new TestRuntimeField(name, "double"), - "date", (name, node, parserContext) -> new TestRuntimeField(name, "date")); - } - } - - private static final class RuntimeField extends TestRuntimeField { - private final String prop1; - private final String prop2; - - protected RuntimeField(String name, String prop1, String prop2) { - super(name, "test"); - this.prop1 = prop1; - this.prop2 = prop2; - } - - @Override - public ValueFetcher valueFetcher(SearchExecutionContext context, String format) { - return null; - } - - @Override - public Query termQuery(Object value, SearchExecutionContext context) { - return null; - } - - @Override - protected void doXContentBody(XContentBuilder builder, boolean includeDefaults) throws IOException { - if (prop1 != null) { - builder.field("prop1", prop1); - } - if (prop2 != null) { - builder.field("prop2", prop2); - } - } + assertEquals("Failed to parse mapping: unknown parameter [unsupported] on mapper [field] of type [keyword]", e.getMessage()); } } diff --git a/server/src/test/java/org/elasticsearch/index/mapper/TestRuntimeField.java b/server/src/test/java/org/elasticsearch/index/mapper/TestRuntimeField.java index f1875212bd055..0baefc46d80b1 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/TestRuntimeField.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/TestRuntimeField.java @@ -9,14 +9,11 @@ package org.elasticsearch.index.mapper; import org.apache.lucene.search.Query; -import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.SearchExecutionContext; -import org.elasticsearch.plugins.MapperPlugin; import java.io.IOException; import java.util.Collections; -import java.util.Map; public class TestRuntimeField extends RuntimeFieldType { @@ -45,46 +42,4 @@ public String typeName() { public Query termQuery(Object value, SearchExecutionContext context) { return null; } - - public static class Plugin extends org.elasticsearch.plugins.Plugin implements MapperPlugin { - @Override - public Map getRuntimeFieldTypes() { - return Map.of( - "keyword", (name, node, parserContext) -> new TestRuntimeField(name, "keyword"), - "double", (name, node, parserContext) -> new TestRuntimeField(name, "double"), - "long", (name, node, parserContext) -> new TestRuntimeField(name, "long"), - "boolean", (name, node, parserContext) -> new TestRuntimeField(name, "boolean"), - "date", (name, node, parserContext) -> new TestRuntimeField(name, "date")); - } - - @Override - public DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder() { - return new DynamicRuntimeFieldsBuilder() { - @Override - public RuntimeFieldType newDynamicStringField(String name) { - return new TestRuntimeField(name, "keyword"); - } - - @Override - public RuntimeFieldType newDynamicLongField(String name) { - return new TestRuntimeField(name, "long"); - } - - @Override - public RuntimeFieldType newDynamicDoubleField(String name) { - return new TestRuntimeField(name, "double"); - } - - @Override - public RuntimeFieldType newDynamicBooleanField(String name) { - return new TestRuntimeField(name, "boolean"); - } - - @Override - public RuntimeFieldType newDynamicDateField(String name, DateFormatter dateFormatter) { - return new TestRuntimeField(name, "date"); - } - }; - } - } } diff --git a/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java b/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java index 2feb12958e11d..3b0dd8630259d 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/TypeParsersTests.java @@ -73,7 +73,7 @@ public void testMultiFieldWithinMultiField() throws IOException { Mapper.TypeParser.ParserContext olderContext = new Mapper.TypeParser.ParserContext(null, type -> typeParser, type -> null, olderVersion, null, null, null, mapperService.getIndexAnalyzers(), mapperService.getIndexSettings(), () -> { throw new UnsupportedOperationException(); - }, false); + }); TextFieldMapper.PARSER.parse("some-field", fieldNode, olderContext); assertWarnings("At least one multi-field, [sub-field], " + @@ -90,7 +90,7 @@ public void testMultiFieldWithinMultiField() throws IOException { Mapper.TypeParser.ParserContext context = new Mapper.TypeParser.ParserContext(null, type -> typeParser, type -> null, version, null, null, null, mapperService.getIndexAnalyzers(), mapperService.getIndexSettings(), () -> { throw new UnsupportedOperationException(); - }, false); + }); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> { TextFieldMapper.PARSER.parse("textField", fieldNodeCopy, context); diff --git a/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java b/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java index c581f4a8b595c..28f9a6e0eeb11 100644 --- a/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/SearchExecutionContextTests.java @@ -59,7 +59,8 @@ import org.elasticsearch.index.mapper.TextFieldMapper; import org.elasticsearch.indices.IndicesModule; import org.elasticsearch.indices.mapper.MapperRegistry; -import org.elasticsearch.plugins.MapperPlugin; +import org.elasticsearch.runtimefields.mapper.KeywordScriptFieldType; +import org.elasticsearch.runtimefields.mapper.LongScriptFieldType; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.support.ValuesSourceType; @@ -316,7 +317,7 @@ public void testFielddataLookupOneFieldManyReferences() throws IOException { } assertEquals( List.of(expected.toString(), expected.toString()), - collect("root", createSearchExecutionContext("uuid", null, createMappingLookup(List.of(), fields), Map.of(), List.of())) + collect("root", createSearchExecutionContext("uuid", null, createMappingLookup(List.of(), fields), Map.of())) ); } @@ -343,13 +344,12 @@ public void testSearchRequestRuntimeFields() { "uuid", null, createMappingLookup(List.of(new MockFieldMapper.FakeFieldType("pig"), new MockFieldMapper.FakeFieldType("cat")), List.of()), - runtimeMappings, - Collections.singletonList(new TestRuntimeField.Plugin())); + runtimeMappings); assertTrue(context.isFieldMapped("cat")); - assertThat(context.getFieldType("cat"), instanceOf(TestRuntimeField.class)); + assertThat(context.getFieldType("cat"), instanceOf(KeywordScriptFieldType.class)); assertThat(context.simpleMatchToIndexNames("cat"), equalTo(Set.of("cat"))); assertTrue(context.isFieldMapped("dog")); - assertThat(context.getFieldType("dog"), instanceOf(TestRuntimeField.class)); + assertThat(context.getFieldType("dog"), instanceOf(LongScriptFieldType.class)); assertThat(context.simpleMatchToIndexNames("dog"), equalTo(Set.of("dog"))); assertTrue(context.isFieldMapped("pig")); assertThat(context.getFieldType("pig"), instanceOf(MockFieldMapper.FakeFieldType.class)); @@ -364,8 +364,7 @@ public void testSearchRequestRuntimeFieldsWrongFormat() { "uuid", null, createMappingLookup(List.of(new MockFieldMapper.FakeFieldType("pig"), new MockFieldMapper.FakeFieldType("cat")), List.of()), - runtimeMappings, - Collections.singletonList(new TestRuntimeField.Plugin()))); + runtimeMappings)); assertEquals("Expected map for runtime field [field] definition but got a java.util.Arrays$ArrayList", exception.getMessage()); } @@ -376,13 +375,12 @@ public void testSearchRequestRuntimeFieldsRemoval() { "uuid", null, createMappingLookup(List.of(new MockFieldMapper.FakeFieldType("pig"), new MockFieldMapper.FakeFieldType("cat")), List.of()), - runtimeMappings, - Collections.singletonList(new TestRuntimeField.Plugin()))); + runtimeMappings)); assertEquals("Runtime field [field] was set to null but its removal is not supported in this context", exception.getMessage()); } public static SearchExecutionContext createSearchExecutionContext(String indexUuid, String clusterAlias) { - return createSearchExecutionContext(indexUuid, clusterAlias, MappingLookup.EMPTY, Map.of(), List.of()); + return createSearchExecutionContext(indexUuid, clusterAlias, MappingLookup.EMPTY, Map.of()); } private static SearchExecutionContext createSearchExecutionContext(RuntimeFieldType... fieldTypes) { @@ -390,8 +388,7 @@ private static SearchExecutionContext createSearchExecutionContext(RuntimeFieldT "uuid", null, createMappingLookup(Collections.emptyList(), List.of(fieldTypes)), - Collections.emptyMap(), - Collections.emptyList() + Collections.emptyMap() ); } @@ -399,8 +396,7 @@ private static SearchExecutionContext createSearchExecutionContext( String indexUuid, String clusterAlias, MappingLookup mappingLookup, - Map runtimeMappings, - List mapperPlugins + Map runtimeMappings ) { IndexMetadata.Builder indexMetadataBuilder = new IndexMetadata.Builder("index"); indexMetadataBuilder.settings(Settings.builder().put("index.version.created", Version.CURRENT) @@ -410,7 +406,7 @@ private static SearchExecutionContext createSearchExecutionContext( ); IndexMetadata indexMetadata = indexMetadataBuilder.build(); IndexSettings indexSettings = new IndexSettings(indexMetadata, Settings.EMPTY); - MapperService mapperService = createMapperService(indexSettings, mapperPlugins); + MapperService mapperService = createMapperService(indexSettings); final long nowInMillis = randomNonNegativeLong(); return new SearchExecutionContext( 0, @@ -436,15 +432,14 @@ private static SearchExecutionContext createSearchExecutionContext( } private static MapperService createMapperService( - IndexSettings indexSettings, - List mapperPlugins + IndexSettings indexSettings ) { IndexAnalyzers indexAnalyzers = new IndexAnalyzers( singletonMap("default", new NamedAnalyzer("default", AnalyzerScope.INDEX, null)), emptyMap(), emptyMap() ); - IndicesModule indicesModule = new IndicesModule(mapperPlugins); + IndicesModule indicesModule = new IndicesModule(Collections.emptyList()); MapperRegistry mapperRegistry = indicesModule.getMapperRegistry(); Supplier searchExecutionContextSupplier = () -> { throw new UnsupportedOperationException(); }; MapperService mapperService = mock(MapperService.class); @@ -459,8 +454,7 @@ private static MapperService createMapperService( null, indexAnalyzers, indexSettings, - () -> true, - false + () -> true )); return mapperService; } diff --git a/server/src/test/java/org/elasticsearch/indices/IndicesModuleTests.java b/server/src/test/java/org/elasticsearch/indices/IndicesModuleTests.java index ba87f305b7812..60e457ea29410 100644 --- a/server/src/test/java/org/elasticsearch/indices/IndicesModuleTests.java +++ b/server/src/test/java/org/elasticsearch/indices/IndicesModuleTests.java @@ -9,13 +9,12 @@ package org.elasticsearch.indices; import org.elasticsearch.Version; -import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.index.mapper.DocCountFieldMapper; -import org.elasticsearch.index.mapper.DynamicRuntimeFieldsBuilder; import org.elasticsearch.index.mapper.FieldNamesFieldMapper; import org.elasticsearch.index.mapper.IdFieldMapper; import org.elasticsearch.index.mapper.IgnoredFieldMapper; import org.elasticsearch.index.mapper.IndexFieldMapper; +import org.elasticsearch.index.mapper.KeywordFieldMapper; import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.MetadataFieldMapper; @@ -24,7 +23,6 @@ import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.index.mapper.SeqNoFieldMapper; import org.elasticsearch.index.mapper.SourceFieldMapper; -import org.elasticsearch.index.mapper.TestRuntimeField; import org.elasticsearch.index.mapper.TextFieldMapper; import org.elasticsearch.index.mapper.VersionFieldMapper; import org.elasticsearch.indices.mapper.MapperRegistry; @@ -172,47 +170,26 @@ public Map getMetadataMappers() { } public void testDuplicateRuntimeFieldPlugin() { - TestRuntimeField.Plugin plugin = new TestRuntimeField.Plugin(); + MapperPlugin plugin = new MapperPlugin() { + @Override + public Map getRuntimeFieldTypes() { + return Map.of("test", (name, node, parserContext) -> null); + } + }; List plugins = Arrays.asList(plugin, plugin); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new IndicesModule(plugins)); assertThat(e.getMessage(), containsString("already registered")); } - public void testTwoDynamicRuntimeFieldsBuilders() { - TestRuntimeField.Plugin plugin = new TestRuntimeField.Plugin(); - MapperPlugin second = new MapperPlugin() { + public void testRuntimeFieldPluginWithBuiltinFieldType() { + MapperPlugin plugin = new MapperPlugin() { @Override - public DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder() { - return new DynamicRuntimeFieldsBuilder() { - @Override - public RuntimeFieldType newDynamicStringField(String name) { - return null; - } - - @Override - public RuntimeFieldType newDynamicLongField(String name) { - return null; - } - - @Override - public RuntimeFieldType newDynamicDoubleField(String name) { - return null; - } - - @Override - public RuntimeFieldType newDynamicBooleanField(String name) { - return null; - } - - @Override - public RuntimeFieldType newDynamicDateField(String name, DateFormatter dateFormatter) { - return null; - } - }; + public Map getRuntimeFieldTypes() { + return Map.of(KeywordFieldMapper.CONTENT_TYPE, (name, node, parserContext) -> null); } }; - List plugins = Arrays.asList(plugin, second); + List plugins = Collections.singletonList(plugin); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new IndicesModule(plugins)); assertThat(e.getMessage(), containsString("already registered")); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java index bb07fdcdc45e9..7882c485c6a82 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractNonTextScriptFieldTypeTestCase.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.util.automaton.Operations; import org.elasticsearch.common.unit.Fuzziness; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java index 74e645fc4da33..001688efe9c85 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/AbstractScriptFieldTypeTestCase.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.index.IndexReader; import org.apache.lucene.search.Query; @@ -29,7 +30,6 @@ import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptEngine; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; import java.io.IOException; import java.util.Collection; @@ -314,7 +314,7 @@ protected final void minimalMapping(XContentBuilder b) throws IOException { @Override protected Collection getPlugins() { - return List.of(new RuntimeFields(Settings.EMPTY), new TestScriptPlugin()); + return List.of(new TestScriptPlugin()); } private static class TestScriptPlugin extends Plugin implements ScriptPlugin { @@ -347,8 +347,9 @@ protected Object buildScriptFactory(ScriptContext context) { throw new IllegalArgumentException("Unsupported context: " + context); } + @Override public Set> getSupportedContexts() { - return Set.copyOf(new RuntimeFields(Settings.EMPTY).getContexts()); + return Collections.emptySet(); } }; } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScriptTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScriptTests.java index e7bfe7eade8d1..6c2d88584505b 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldTypeTests.java similarity index 98% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldTypeTests.java index 0981dad711d76..844d33867fd7b 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/BooleanScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -40,6 +41,7 @@ import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.BooleanScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -49,8 +51,6 @@ import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.BooleanScriptFieldData; import java.io.IOException; import java.util.ArrayList; @@ -417,7 +417,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(DoubleFieldScript.CONTEXT); + return Set.of(); } @Override @@ -456,7 +456,7 @@ public void execute() { return (fieldName, params, lookup) -> { // Indicate that this script wants the field call "test", which *is* the name of this field lookup.forkAndTrackFieldReferences("test"); - throw new IllegalStateException("shoud have thrown on the line above"); + throw new IllegalStateException("should have thrown on the line above"); }; default: throw new IllegalArgumentException("unsupported script [" + code + "]"); @@ -465,7 +465,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { BooleanFieldScript.Factory factory = scriptService.compile(script, BooleanFieldScript.CONTEXT); return new BooleanScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DateFieldScriptTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/DateFieldScriptTests.java index 2e15525fdaf02..9744c5f88dd3d 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DateFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldTypeTests.java similarity index 98% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldTypeTests.java index 1aaaba89614f3..f703f60fa4406 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DateScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DateScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -43,6 +44,7 @@ import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.DateScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -51,8 +53,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.DateScriptFieldData; import java.io.IOException; import java.time.Instant; @@ -485,7 +485,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(DateFieldScript.CONTEXT); + return Set.of(); } @Override @@ -549,7 +549,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { DateFieldScript.Factory factory = scriptService.compile(script, DateFieldScript.CONTEXT); return new DateScriptFieldType("test", factory, dateTimeFormatter, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScriptTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScriptTests.java index be569a7b21381..55df2f31e8ed9 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldTypeTests.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldTypeTests.java index f036330929bbc..e57d9249f4130 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DoubleScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -31,6 +32,7 @@ import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.DoubleScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -39,8 +41,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.DoubleScriptFieldData; import java.io.IOException; import java.util.ArrayList; @@ -259,7 +259,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(DoubleFieldScript.CONTEXT); + return Set.of(); } @Override @@ -307,7 +307,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { DoubleFieldScript.Factory factory = scriptService.compile(script, DoubleFieldScript.CONTEXT); return new DoubleScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeTests.java index eabc7a87f59a9..94b2c8930d39d 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/DynamicRuntimeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/DynamicRuntimeTests.java @@ -1,30 +1,22 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.MapperServiceTestCase; import org.elasticsearch.index.mapper.ObjectMapper; import org.elasticsearch.index.mapper.ParsedDocument; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; import java.io.IOException; -import java.util.Collection; -import java.util.Collections; public class DynamicRuntimeTests extends MapperServiceTestCase { - @Override - protected Collection getPlugins() { - return Collections.singletonList(new RuntimeFields(Settings.EMPTY)); - } public void testDynamicLeafFields() throws IOException { DocumentMapper documentMapper = createDocumentMapper(topMapping(b -> b.field("dynamic", ObjectMapper.Dynamic.RUNTIME))); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/FieldScriptTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/FieldScriptTestCase.java similarity index 80% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/FieldScriptTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/FieldScriptTestCase.java index 9f2d6051ab0a2..95102ad4eb5e6 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/FieldScriptTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/FieldScriptTestCase.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScriptTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScriptTests.java index 81783400995bf..ff29479348c0a 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldTypeTests.java similarity index 96% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldTypeTests.java index 2cb9145c18165..c7f6763ebc297 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/GeoPointScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/GeoPointScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -30,6 +31,7 @@ import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.GeoPointScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -38,8 +40,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.GeoPointScriptFieldData; import java.io.IOException; import java.util.ArrayList; @@ -229,7 +229,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(StringFieldScript.CONTEXT, GeoPointFieldScript.CONTEXT); + return Set.of(); } @Override @@ -267,7 +267,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { GeoPointFieldScript.Factory factory = scriptService.compile(script, GeoPointFieldScript.CONTEXT); return new GeoPointScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/IpFieldScriptTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/IpFieldScriptTests.java index 76891d580b937..6cc01b8a4c5bc 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/IpFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldTypeTests.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldTypeTests.java index 6976f6e107f8f..eac1bfcff01ae 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/IpScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -30,6 +31,8 @@ import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.BinaryScriptFieldData; +import org.elasticsearch.runtimefields.fielddata.IpScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -39,9 +42,6 @@ import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.BinaryScriptFieldData; -import org.elasticsearch.xpack.runtimefields.fielddata.IpScriptFieldData; import java.io.IOException; import java.time.ZoneId; @@ -324,7 +324,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { IpFieldScript.Factory factory = scriptService.compile(script, IpFieldScript.CONTEXT); return new IpScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldTypeTests.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldTypeTests.java index da7f64781bb11..475426a991a29 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/KeywordScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/KeywordScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -34,6 +35,8 @@ import org.elasticsearch.index.query.MatchQueryBuilder; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.BinaryScriptFieldData; +import org.elasticsearch.runtimefields.fielddata.StringScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -42,9 +45,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.BinaryScriptFieldData; -import org.elasticsearch.xpack.runtimefields.fielddata.StringScriptFieldData; import java.io.IOException; import java.util.ArrayList; @@ -391,7 +391,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(StringFieldScript.CONTEXT); + return Set.of(); } @Override @@ -439,7 +439,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { StringFieldScript.Factory factory = scriptService.compile(script, StringFieldScript.CONTEXT); return new KeywordScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/LongFieldScriptTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/LongFieldScriptTests.java index 327459f2511b7..10f08465b1247 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/LongFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldTypeTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldTypeTests.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldTypeTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldTypeTests.java index 7d9e72272ae0d..7957858a2442d 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/LongScriptFieldTypeTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/LongScriptFieldTypeTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -35,6 +36,7 @@ import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.plugins.ScriptPlugin; +import org.elasticsearch.runtimefields.fielddata.LongScriptFieldData; import org.elasticsearch.script.ScoreScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; @@ -43,8 +45,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.fielddata.LongScriptFieldData; import java.io.IOException; import java.util.ArrayList; @@ -293,7 +293,7 @@ public String getType() { @Override public Set> getSupportedContexts() { - return Set.of(LongFieldScript.CONTEXT); + return Set.of(); } @Override @@ -352,7 +352,7 @@ public void execute() { }; } }; - ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin, new RuntimeFields(Settings.EMPTY))); + ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, List.of(scriptPlugin)); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { LongFieldScript.Factory factory = scriptService.compile(script, LongFieldScript.CONTEXT); return new LongScriptFieldType("test", factory, script, emptyMap(), (b, d) -> {}); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/StringFieldScriptTests.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/StringFieldScriptTests.java index d1f0210abf6c7..265733e6259b2 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/StringFieldScriptTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/TestScriptEngine.java b/server/src/test/java/org/elasticsearch/runtimefields/mapper/TestScriptEngine.java similarity index 86% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/TestScriptEngine.java rename to server/src/test/java/org/elasticsearch/runtimefields/mapper/TestScriptEngine.java index 1bf3284f2b460..0ea7bc98c5184 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/TestScriptEngine.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/mapper/TestScriptEngine.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.mapper; +package org.elasticsearch.runtimefields.mapper; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.ScriptContext; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java similarity index 83% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java index 0feac1da54483..dbbafefe9b59f 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractBooleanScriptFieldQueryTestCase.java @@ -1,17 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.automaton.ByteRunAutomaton; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; import java.util.ArrayList; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java similarity index 64% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java index 62999e032a464..ef19cd9d24522 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java @@ -1,13 +1,14 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; import static org.mockito.Mockito.mock; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java similarity index 65% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java index 90d6349febfa1..073f4cd63ef18 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractGeoPointScriptFieldQueryTestCase.java @@ -1,13 +1,14 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import static org.mockito.Mockito.mock; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java similarity index 72% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java index 37f046000a1b2..27c186e5ad7ec 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java similarity index 65% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java index b4c2cfbbec252..b668edbe65f11 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTestCase.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTestCase.java index 63c41ed467732..c457248b749d8 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTestCase.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTests.java similarity index 84% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTests.java index 303fe78df5f9e..aa1adef736676 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractScriptFieldQueryTests.java @@ -1,16 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.search.Explanation; +import org.elasticsearch.runtimefields.mapper.AbstractFieldScript; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractFieldScript; import java.io.IOException; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java similarity index 85% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java index 78e75c6a217b6..9ae83d663d4d6 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java @@ -1,17 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.automaton.ByteRunAutomaton; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import java.util.ArrayList; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQueryTests.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQueryTests.java index fd822473a74c6..2c306bc246a64 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQueryTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQueryTests.java index 99c8749564e43..996ad88afc8f1 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/BooleanScriptFieldTermQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.elasticsearch.script.Script; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQueryTests.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQueryTests.java index a77d23c65ef72..565f4803a88ab 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQueryTests.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQueryTests.java index 5143766f58bcd..179a0447ef325 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldRangeQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQueryTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQueryTests.java index 9b9e9fe7036dd..2e6b63f839a02 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQueryTests.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQueryTests.java index 85d7832e5c235..2a926a62f630a 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/DoubleScriptFieldTermsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java index 5e84ad5581af1..5fa8a29ff2270 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldDistanceFeatureQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.document.StoredField; import org.apache.lucene.geo.GeoTestUtil; @@ -19,10 +20,10 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.geo.GeoUtils; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; import java.io.IOException; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java index c2a30c49960cc..ab075d3772605 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java index f82daa1087611..79f15428da409 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/GeoPointScriptFieldGeoShapeQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.geo.Polygon; import org.elasticsearch.common.geo.ShapeRelation; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQueryTests.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQueryTests.java index 8b9cd4b49c042..2df60dccac286 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQueryTests.java similarity index 96% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQueryTests.java index 67bc3375697fa..1ba0010e02261 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldRangeQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQueryTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQueryTests.java index 0f04837ae74bc..7439836cc3790 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQueryTests.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQueryTests.java index 69208db25d46f..1234033689a1d 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/IpScriptFieldTermsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.util.BytesRef; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java index fb2c24e7e7cd5..757b26cddb1a0 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -16,11 +17,11 @@ import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.runtimefields.mapper.AbstractLongFieldScript; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; import java.io.IOException; import java.util.List; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQueryTests.java similarity index 87% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQueryTests.java index 5bf18e81ce71d..095f580fb7a91 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQueryTests.java similarity index 92% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQueryTests.java index 6c2549d51a967..20368894f0b1e 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldRangeQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQueryTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQueryTests.java index 68498f352ce2d..26a999b78ebda 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQueryTests.java similarity index 91% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQueryTests.java index 78be4eedef47a..35a01caeae560 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/LongScriptFieldTermsQueryTests.java @@ -1,15 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; - import org.elasticsearch.script.Script; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQueryTests.java similarity index 90% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQueryTests.java index d28d7ac5633b8..a09b3a845c91b 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldExistsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQueryTests.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQueryTests.java index 58bcf2ea0055b..6bd9a81346d93 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldFuzzyQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQueryTests.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQueryTests.java index 3904cad0f4978..190dad908ea85 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldPrefixQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQueryTests.java similarity index 97% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQueryTests.java index 3a1736740ff04..fa374f4300fa4 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRangeQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQueryTests.java similarity index 95% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQueryTests.java index f7c4a29243a71..a4bffde84fb3f 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldRegexpQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQueryTests.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQueryTests.java index 20162bf981b1d..dc788cac55fe1 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQueryTests.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQueryTests.java index 4432bb320f1e4..f6bb1887651c3 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldTermsQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQueryTests.java b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQueryTests.java similarity index 93% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQueryTests.java rename to server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQueryTests.java index 2c4f08e935804..93344cee19fd9 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQueryTests.java +++ b/server/src/test/java/org/elasticsearch/runtimefields/query/StringScriptFieldWildcardQueryTests.java @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -package org.elasticsearch.xpack.runtimefields.query; +package org.elasticsearch.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/test/framework/src/main/java/org/elasticsearch/script/MockScriptEngine.java b/test/framework/src/main/java/org/elasticsearch/script/MockScriptEngine.java index 243ef4633af74..995f18232b49d 100644 --- a/test/framework/src/main/java/org/elasticsearch/script/MockScriptEngine.java +++ b/test/framework/src/main/java/org/elasticsearch/script/MockScriptEngine.java @@ -15,6 +15,13 @@ import org.elasticsearch.index.similarity.ScriptedSimilarity.Field; import org.elasticsearch.index.similarity.ScriptedSimilarity.Query; import org.elasticsearch.index.similarity.ScriptedSimilarity.Term; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.LongFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.search.aggregations.pipeline.MovingFunctionScript; import org.elasticsearch.search.lookup.LeafSearchLookup; import org.elasticsearch.search.lookup.SearchLookup; @@ -231,6 +238,62 @@ public double execute(Map params1, double[] values) { } else if (context.instanceClazz.equals(IntervalFilterScript.class)) { IntervalFilterScript.Factory factory = mockCompiled::createIntervalFilterScript; return context.factoryClazz.cast(factory); + } else if (context.instanceClazz.equals(BooleanFieldScript.class)) { + BooleanFieldScript.Factory booleanFieldScript = (f, p, s) -> ctx -> new BooleanFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit(true); + } + }; + return context.factoryClazz.cast(booleanFieldScript); + } else if (context.instanceClazz.equals(StringFieldScript.class)) { + StringFieldScript.Factory stringFieldScript = (f, p, s) -> ctx -> new StringFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit("test"); + } + }; + return context.factoryClazz.cast(stringFieldScript); + } else if (context.instanceClazz.equals(LongFieldScript.class)) { + LongFieldScript.Factory longFieldScript = (f, p, s) -> ctx -> new LongFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit(1L); + } + }; + return context.factoryClazz.cast(longFieldScript); + } else if (context.instanceClazz.equals(DoubleFieldScript.class)) { + DoubleFieldScript.Factory doubleFieldScript = (f, p, s) -> ctx -> new DoubleFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit(1.2D); + } + }; + return context.factoryClazz.cast(doubleFieldScript); + } else if (context.instanceClazz.equals(DateFieldScript.class)) { + DateFieldScript.Factory dateFieldScript = (f, p, s, formatter) -> ctx -> new DateFieldScript(f, p, s, formatter, ctx) { + @Override + public void execute() { + emit(123L); + } + }; + return context.factoryClazz.cast(dateFieldScript); + } else if (context.instanceClazz.equals(IpFieldScript.class)) { + IpFieldScript.Factory ipFieldScript = (f, p, s) -> ctx -> new IpFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit("127.0.0.1"); + } + }; + return context.factoryClazz.cast(ipFieldScript); + } else if (context.instanceClazz.equals(GeoPointFieldScript.class)) { + GeoPointFieldScript.Factory geoPointFieldScript = (f, p, s) -> ctx -> new GeoPointFieldScript(f, p, s, ctx) { + @Override + public void execute() { + emit(1.2D, 1.2D); + } + }; + return context.factoryClazz.cast(geoPointFieldScript); } ContextCompiler compiler = contexts.get(context); if (compiler != null) { diff --git a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java index cf7a274a5bee2..0c0da065a3850 100644 --- a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java @@ -83,8 +83,8 @@ import org.elasticsearch.index.mapper.RangeType; import org.elasticsearch.index.mapper.TextFieldMapper; import org.elasticsearch.index.query.QueryRewriteContext; -import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.index.query.Rewriteable; +import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.indices.IndicesModule; @@ -874,7 +874,7 @@ private void writeTestDoc(MappedFieldType fieldType, String fieldName, RandomInd private static class MockParserContext extends Mapper.TypeParser.ParserContext { MockParserContext() { - super(null, null, null, null, null, null, null, null, null, null, false); + super(null, null, null, null, null, null, null, null, null, null); } @Override diff --git a/x-pack/plugin/runtime-fields/build.gradle b/x-pack/plugin/runtime-fields/build.gradle index 928061c231174..0bb1b30ab4f59 100644 --- a/x-pack/plugin/runtime-fields/build.gradle +++ b/x-pack/plugin/runtime-fields/build.gradle @@ -19,3 +19,6 @@ dependencies { tasks.named("dependencyLicenses").configure { ignoreSha 'x-pack-core' } + +//this plugin is here only for the painless extension, there are no unit tests +tasks.named("testingConventions").configure { enabled = false } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFields.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFields.java index 50805fb226dca..bf17a435555c9 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFields.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFields.java @@ -19,48 +19,22 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.env.Environment; import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.index.mapper.BooleanFieldMapper; -import org.elasticsearch.index.mapper.DateFieldMapper; -import org.elasticsearch.index.mapper.DynamicRuntimeFieldsBuilder; -import org.elasticsearch.index.mapper.GeoPointFieldMapper; -import org.elasticsearch.index.mapper.IpFieldMapper; -import org.elasticsearch.index.mapper.KeywordFieldMapper; -import org.elasticsearch.index.mapper.NumberFieldMapper; -import org.elasticsearch.index.mapper.RuntimeFieldType; import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.plugins.MapperPlugin; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.plugins.ScriptPlugin; import org.elasticsearch.repositories.RepositoriesService; -import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.watcher.ResourceWatcherService; import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.BooleanScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.DateScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.DoubleScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.GeoPointScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.IpScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.KeywordScriptFieldType; -import org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript; -import org.elasticsearch.xpack.runtimefields.mapper.LongScriptFieldType; import org.elasticsearch.xpack.runtimefields.mapper.NamedGroupExtractor; import org.elasticsearch.xpack.runtimefields.mapper.NamedGroupExtractor.GrokHelper; -import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.function.Supplier; -public final class RuntimeFields extends Plugin implements MapperPlugin, ScriptPlugin, ActionPlugin { +public final class RuntimeFields extends Plugin implements ActionPlugin { static final Setting GROK_WATCHDOG_INTERVAL = Setting.timeSetting( "runtime_fields.grok.watchdog.interval", @@ -87,37 +61,6 @@ public List> getSettings() { return List.of(GROK_WATCHDOG_INTERVAL, GROK_WATCHDOG_MAX_EXECUTION_TIME); } - @Override - public Map getRuntimeFieldTypes() { - return Map.ofEntries( - Map.entry(BooleanFieldMapper.CONTENT_TYPE, BooleanScriptFieldType.PARSER), - Map.entry(NumberFieldMapper.NumberType.LONG.typeName(), LongScriptFieldType.PARSER), - Map.entry(NumberFieldMapper.NumberType.DOUBLE.typeName(), DoubleScriptFieldType.PARSER), - Map.entry(IpFieldMapper.CONTENT_TYPE, IpScriptFieldType.PARSER), - Map.entry(DateFieldMapper.CONTENT_TYPE, DateScriptFieldType.PARSER), - Map.entry(KeywordFieldMapper.CONTENT_TYPE, KeywordScriptFieldType.PARSER), - Map.entry(GeoPointFieldMapper.CONTENT_TYPE, GeoPointScriptFieldType.PARSER) - ); - } - - @Override - public List> getContexts() { - return List.of( - BooleanFieldScript.CONTEXT, - DateFieldScript.CONTEXT, - DoubleFieldScript.CONTEXT, - GeoPointFieldScript.CONTEXT, - IpFieldScript.CONTEXT, - LongFieldScript.CONTEXT, - StringFieldScript.CONTEXT - ); - } - - @Override - public DynamicRuntimeFieldsBuilder getDynamicRuntimeFieldsBuilder() { - return org.elasticsearch.xpack.runtimefields.mapper.DynamicRuntimeFieldsBuilder.INSTANCE; - } - @Override public List> getActions() { return List.of( diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java index 88a95c82d05cd..b31767b1d3ad2 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java @@ -12,6 +12,14 @@ import org.elasticsearch.painless.spi.WhitelistInstanceBinding; import org.elasticsearch.painless.spi.WhitelistLoader; import org.elasticsearch.painless.spi.annotation.CompileTimeOnlyAnnotation; +import org.elasticsearch.runtimefields.mapper.AbstractFieldScript; +import org.elasticsearch.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.runtimefields.mapper.DateFieldScript; +import org.elasticsearch.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.runtimefields.mapper.GeoPointFieldScript; +import org.elasticsearch.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.runtimefields.mapper.LongFieldScript; +import org.elasticsearch.runtimefields.mapper.StringFieldScript; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.xpack.runtimefields.RuntimeFields; @@ -19,12 +27,11 @@ import java.util.Map; public class RuntimeFieldsPainlessExtension implements PainlessExtension { - private final Whitelist commonWhitelist = WhitelistLoader.loadFromResourceFiles(AbstractFieldScript.class, "common_whitelist.txt"); - - private final Whitelist grokWhitelist; + private final List whitelists; public RuntimeFieldsPainlessExtension(RuntimeFields plugin) { - grokWhitelist = new Whitelist( + Whitelist commonWhitelist = WhitelistLoader.loadFromResourceFiles(RuntimeFieldsPainlessExtension.class, "common_whitelist.txt"); + Whitelist grokWhitelist = new Whitelist( commonWhitelist.classLoader, List.of(), List.of(), @@ -40,22 +47,19 @@ public RuntimeFieldsPainlessExtension(RuntimeFields plugin) { ) ) ); - } - - private List load(String path) { - return List.of(commonWhitelist, grokWhitelist, WhitelistLoader.loadFromResourceFiles(AbstractFieldScript.class, path)); + this.whitelists = List.of(commonWhitelist, grokWhitelist); } @Override public Map, List> getContextWhitelists() { return Map.ofEntries( - Map.entry(BooleanFieldScript.CONTEXT, load("boolean_whitelist.txt")), - Map.entry(DateFieldScript.CONTEXT, load("date_whitelist.txt")), - Map.entry(DoubleFieldScript.CONTEXT, load("double_whitelist.txt")), - Map.entry(GeoPointFieldScript.CONTEXT, load("geo_point_whitelist.txt")), - Map.entry(IpFieldScript.CONTEXT, load("ip_whitelist.txt")), - Map.entry(LongFieldScript.CONTEXT, load("long_whitelist.txt")), - Map.entry(StringFieldScript.CONTEXT, load("string_whitelist.txt")) + Map.entry(BooleanFieldScript.CONTEXT, whitelists), + Map.entry(DateFieldScript.CONTEXT, whitelists), + Map.entry(DoubleFieldScript.CONTEXT, whitelists), + Map.entry(GeoPointFieldScript.CONTEXT, whitelists), + Map.entry(IpFieldScript.CONTEXT, whitelists), + Map.entry(LongFieldScript.CONTEXT, whitelists), + Map.entry(StringFieldScript.CONTEXT, whitelists) ); } } diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt deleted file mode 100644 index adc5079bf0b96..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for boolean-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript, boolean) bound_to org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript$Emit -} - diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt deleted file mode 100644 index 172840755b927..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for date-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript, long) bound_to org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript$Emit - # Parse a value from the source to millis since epoch - long parse(org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript, def) bound_to org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript$Parse -} - - - diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt deleted file mode 100644 index aafb7d37c95ad..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for double-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript, double) bound_to org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript$Emit -} - diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/geo_point_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/geo_point_whitelist.txt deleted file mode 100644 index 312ba4bd76638..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/geo_point_whitelist.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for ip-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript, double, double) bound_to org.elasticsearch.xpack.runtimefields.mapper.GeoPointFieldScript$Emit -} diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt deleted file mode 100644 index ec8578c36a23d..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for ip-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript, String) bound_to org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript$Emit -} diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt deleted file mode 100644 index 54706ec69f535..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for long-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript, long) bound_to org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript$Emit -} diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt deleted file mode 100644 index e47f97b981caa..0000000000000 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -# The whitelist for string-valued runtime fields - -# These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript @no_import { -} -class org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript$Factory @no_import { -} - -static_import { - # The `emit` callback to collect values for the field - void emit(org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript, String) bound_to org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript$Emit -}