From 1e352fdb7f94b41e28e2c67a38ae91f8b81d9970 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Wed, 16 Sep 2020 18:00:06 +0200 Subject: [PATCH] Runtime fields: rename script classes (#62448) With this commit we rename the script classes used for each mapped field type used for runtime fields. The new naming is a shorter version of the previous one: from e.g. BooleanScriptFieldScrip to BooleanScript . We also move such classes to the existing mapper package. --- .../xpack/runtimefields/RuntimeFields.java | 18 ++++--- .../fielddata/ScriptBooleanDocValues.java | 6 +-- .../fielddata/ScriptBooleanFieldData.java | 10 ++-- .../fielddata/ScriptDateFieldData.java | 10 ++-- .../fielddata/ScriptDoubleDocValues.java | 6 +-- .../fielddata/ScriptDoubleFieldData.java | 10 ++-- .../fielddata/ScriptIpDocValues.java | 6 +-- .../fielddata/ScriptIpFieldData.java | 12 ++--- .../fielddata/ScriptLongDocValues.java | 6 +-- .../fielddata/ScriptLongFieldData.java | 10 ++-- .../fielddata/ScriptStringDocValues.java | 6 +-- .../fielddata/ScriptStringFieldData.java | 12 ++--- .../AbstractFieldScript.java} | 6 +-- .../AbstractLongFieldScript.java} | 6 +-- .../BooleanFieldScript.java} | 12 ++--- .../DateFieldScript.java} | 16 +++--- .../DoubleFieldScript.java} | 12 ++--- .../IpFieldScript.java} | 14 ++--- .../LongFieldScript.java} | 12 ++--- .../mapper/RuntimeFieldMapper.java | 36 +++---------- .../RuntimeFieldsPainlessExtension.java | 26 +++++----- .../mapper/ScriptBooleanMappedFieldType.java | 5 +- .../mapper/ScriptDateMappedFieldType.java | 6 +-- .../mapper/ScriptDoubleMappedFieldType.java | 6 +-- .../mapper/ScriptIpMappedFieldType.java | 5 +- .../mapper/ScriptKeywordMappedFieldType.java | 5 +- .../mapper/ScriptLongMappedFieldType.java | 6 +-- .../StringFieldScript.java} | 12 ++--- .../AbstractBooleanScriptFieldQuery.java | 12 ++--- .../query/AbstractDoubleScriptFieldQuery.java | 10 ++-- .../query/AbstractIpScriptFieldQuery.java | 12 ++--- .../query/AbstractLongScriptFieldQuery.java | 10 ++-- .../query/AbstractScriptFieldQuery.java | 4 +- ...stractStringScriptFieldAutomatonQuery.java | 4 +- .../query/AbstractStringScriptFieldQuery.java | 10 ++-- .../query/BooleanScriptFieldExistsQuery.java | 4 +- .../query/BooleanScriptFieldTermQuery.java | 4 +- .../query/DoubleScriptFieldExistsQuery.java | 4 +- .../query/DoubleScriptFieldRangeQuery.java | 4 +- .../query/DoubleScriptFieldTermQuery.java | 4 +- .../query/DoubleScriptFieldTermsQuery.java | 5 +- .../query/IpScriptFieldExistsQuery.java | 4 +- .../query/IpScriptFieldRangeQuery.java | 10 +--- .../query/IpScriptFieldTermQuery.java | 4 +- .../query/IpScriptFieldTermsQuery.java | 4 +- .../LongScriptFieldDistanceFeatureQuery.java | 18 +++---- .../query/LongScriptFieldExistsQuery.java | 8 +-- .../query/LongScriptFieldRangeQuery.java | 4 +- .../query/LongScriptFieldTermQuery.java | 4 +- .../query/LongScriptFieldTermsQuery.java | 4 +- .../query/StringScriptFieldExistsQuery.java | 4 +- .../query/StringScriptFieldFuzzyQuery.java | 6 +-- .../query/StringScriptFieldPrefixQuery.java | 4 +- .../query/StringScriptFieldRangeQuery.java | 4 +- .../query/StringScriptFieldRegexpQuery.java | 4 +- .../query/StringScriptFieldTermQuery.java | 4 +- .../query/StringScriptFieldTermsQuery.java | 9 +--- .../query/StringScriptFieldWildcardQuery.java | 9 +--- ...asticsearch.painless.spi.PainlessExtension | 2 +- .../{ => mapper}/boolean_whitelist.txt | 8 +-- .../{ => mapper}/date_whitelist.txt | 10 ++-- .../{ => mapper}/double_whitelist.txt | 6 +-- .../{ => mapper}/ip_whitelist.txt | 6 +-- .../{ => mapper}/long_whitelist.txt | 6 +-- .../{ => mapper}/string_whitelist.txt | 6 +-- .../BooleanFieldScriptTests.java} | 16 +++--- .../DateFieldScriptTests.java} | 16 +++--- .../DoubleFieldScriptTests.java} | 16 +++--- .../FieldScriptTestCase.java} | 4 +- .../IpFieldScriptTests.java} | 16 +++--- .../LongFieldScriptTests.java} | 16 +++--- .../mapper/RuntimeFieldMapperTests.java | 51 +++++++------------ .../ScriptBooleanMappedFieldTypeTests.java | 22 ++------ .../ScriptDateMappedFieldTypeTests.java | 13 +++-- .../ScriptDoubleMappedFieldTypeTests.java | 11 ++-- .../mapper/ScriptIpMappedFieldTypeTests.java | 12 ++--- .../ScriptKeywordMappedFieldTypeTests.java | 11 ++-- .../ScriptLongMappedFieldTypeTests.java | 13 +++-- .../StringFieldScriptTests.java} | 20 ++++---- .../{ => mapper}/TestScriptEngine.java | 2 +- ...stractBooleanScriptFieldQueryTestCase.java | 4 +- ...bstractDoubleScriptFieldQueryTestCase.java | 4 +- .../AbstractIpScriptFieldQueryTestCase.java | 4 +- .../AbstractLongScriptFieldQueryTestCase.java | 4 +- ...bstractStringScriptFieldQueryTestCase.java | 4 +- .../DoubleScriptFieldTermsQueryTests.java | 1 - ...gScriptFieldDistanceFeatureQueryTests.java | 8 +-- 87 files changed, 360 insertions(+), 440 deletions(-) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{AbstractScriptFieldScript.java => mapper/AbstractFieldScript.java} (94%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{AbstractLongScriptFieldScript.java => mapper/AbstractLongFieldScript.java} (84%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{BooleanScriptFieldScript.java => mapper/BooleanFieldScript.java} (83%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{DateScriptFieldScript.java => mapper/DateFieldScript.java} (84%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{DoubleScriptFieldScript.java => mapper/DoubleFieldScript.java} (85%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{IpScriptFieldScript.java => mapper/IpFieldScript.java} (89%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{LongScriptFieldScript.java => mapper/LongFieldScript.java} (76%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{ => mapper}/RuntimeFieldsPainlessExtension.java (53%) rename x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/{StringScriptFieldScript.java => mapper/StringFieldScript.java} (86%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/boolean_whitelist.txt (59%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/date_whitelist.txt (53%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/double_whitelist.txt (56%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/ip_whitelist.txt (57%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/long_whitelist.txt (57%) rename x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/{ => mapper}/string_whitelist.txt (56%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{BooleanScriptFieldScriptTests.java => mapper/BooleanFieldScriptTests.java} (73%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{DateScriptFieldScriptTests.java => mapper/DateFieldScriptTests.java} (78%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{DoubleScriptFieldScriptTests.java => mapper/DoubleFieldScriptTests.java} (76%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{ScriptFieldScriptTestCase.java => mapper/FieldScriptTestCase.java} (89%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{IpScriptFieldScriptTests.java => mapper/IpFieldScriptTests.java} (77%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{LongScriptFieldScriptTests.java => mapper/LongFieldScriptTests.java} (76%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{StringScriptFieldScriptTests.java => mapper/StringFieldScriptTests.java} (81%) rename x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/{ => mapper}/TestScriptEngine.java (96%) 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 db8a22ba89d..22b6690eedb 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 @@ -11,7 +11,13 @@ import org.elasticsearch.plugins.MapperPlugin; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.ScriptPlugin; import org.elasticsearch.script.ScriptContext; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript; import org.elasticsearch.xpack.runtimefields.mapper.RuntimeFieldMapper; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Collections; import java.util.List; @@ -27,12 +33,12 @@ public final class RuntimeFields extends Plugin implements MapperPlugin, ScriptP @Override public List> getContexts() { return org.elasticsearch.common.collect.List.of( - BooleanScriptFieldScript.CONTEXT, - DateScriptFieldScript.CONTEXT, - DoubleScriptFieldScript.CONTEXT, - IpScriptFieldScript.CONTEXT, - LongScriptFieldScript.CONTEXT, - StringScriptFieldScript.CONTEXT + BooleanFieldScript.CONTEXT, + DateFieldScript.CONTEXT, + DoubleFieldScript.CONTEXT, + IpFieldScript.CONTEXT, + LongFieldScript.CONTEXT, + StringFieldScript.CONTEXT ); } } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanDocValues.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanDocValues.java index f91fe3d300e..9f787201786 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanDocValues.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanDocValues.java @@ -7,15 +7,15 @@ package org.elasticsearch.xpack.runtimefields.fielddata; import org.elasticsearch.index.fielddata.AbstractSortedNumericDocValues; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; import java.io.IOException; public final class ScriptBooleanDocValues extends AbstractSortedNumericDocValues { - private final BooleanScriptFieldScript script; + private final BooleanFieldScript script; private int cursor; - ScriptBooleanDocValues(BooleanScriptFieldScript script) { + ScriptBooleanDocValues(BooleanFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanFieldData.java index 41a8c814bdd..b0e7e90426f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptBooleanFieldData.java @@ -17,7 +17,7 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; import java.io.IOException; @@ -25,9 +25,9 @@ public final class ScriptBooleanFieldData extends IndexNumericFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final BooleanScriptFieldScript.LeafFactory leafFactory; + private final BooleanFieldScript.LeafFactory leafFactory; - public Builder(String name, BooleanScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, BooleanFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -39,9 +39,9 @@ public final class ScriptBooleanFieldData extends IndexNumericFieldData { } private final String fieldName; - private final BooleanScriptFieldScript.LeafFactory leafFactory; + private final BooleanFieldScript.LeafFactory leafFactory; - private ScriptBooleanFieldData(String fieldName, BooleanScriptFieldScript.LeafFactory leafFactory) { + private ScriptBooleanFieldData(String fieldName, BooleanFieldScript.LeafFactory leafFactory) { this.fieldName = fieldName; this.leafFactory = leafFactory; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDateFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDateFieldData.java index 4a4e9b58e47..27ef92745ef 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDateFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDateFieldData.java @@ -17,7 +17,7 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.DateScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; import java.io.IOException; @@ -25,9 +25,9 @@ public final class ScriptDateFieldData extends IndexNumericFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final DateScriptFieldScript.LeafFactory leafFactory; + private final DateFieldScript.LeafFactory leafFactory; - public Builder(String name, DateScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, DateFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -39,9 +39,9 @@ public final class ScriptDateFieldData extends IndexNumericFieldData { } private final String fieldName; - private final DateScriptFieldScript.LeafFactory leafFactory; + private final DateFieldScript.LeafFactory leafFactory; - private ScriptDateFieldData(String fieldName, DateScriptFieldScript.LeafFactory leafFactory) { + private ScriptDateFieldData(String fieldName, DateFieldScript.LeafFactory leafFactory) { this.fieldName = fieldName; this.leafFactory = leafFactory; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleDocValues.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleDocValues.java index 135229e260e..4b2056c3d1e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleDocValues.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleDocValues.java @@ -7,16 +7,16 @@ package org.elasticsearch.xpack.runtimefields.fielddata; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.io.IOException; import java.util.Arrays; public final class ScriptDoubleDocValues extends SortedNumericDoubleValues { - private final DoubleScriptFieldScript script; + private final DoubleFieldScript script; private int cursor; - ScriptDoubleDocValues(DoubleScriptFieldScript script) { + ScriptDoubleDocValues(DoubleFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleFieldData.java index a15a79016e4..c91476dd707 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptDoubleFieldData.java @@ -17,7 +17,7 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.io.IOException; @@ -25,9 +25,9 @@ public final class ScriptDoubleFieldData extends IndexNumericFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final DoubleScriptFieldScript.LeafFactory leafFactory; + private final DoubleFieldScript.LeafFactory leafFactory; - public Builder(String name, DoubleScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, DoubleFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -39,9 +39,9 @@ public final class ScriptDoubleFieldData extends IndexNumericFieldData { } private final String fieldName; - DoubleScriptFieldScript.LeafFactory leafFactory; + DoubleFieldScript.LeafFactory leafFactory; - private ScriptDoubleFieldData(String fieldName, DoubleScriptFieldScript.LeafFactory leafFactory) { + private ScriptDoubleFieldData(String fieldName, DoubleFieldScript.LeafFactory leafFactory) { this.fieldName = fieldName; this.leafFactory = leafFactory; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpDocValues.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpDocValues.java index 0cecde2302d..6c6d3eaf9de 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpDocValues.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpDocValues.java @@ -8,16 +8,16 @@ package org.elasticsearch.xpack.runtimefields.fielddata; import org.apache.lucene.util.BytesRef; import org.elasticsearch.index.fielddata.SortedBinaryDocValues; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.io.IOException; import java.util.Arrays; public final class ScriptIpDocValues extends SortedBinaryDocValues { - private final IpScriptFieldScript script; + private final IpFieldScript script; private int cursor; - ScriptIpDocValues(IpScriptFieldScript script) { + ScriptIpDocValues(IpFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpFieldData.java index e9e7e86b3ab..bcee8870b55 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptIpFieldData.java @@ -21,16 +21,16 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; public class ScriptIpFieldData extends ScriptBinaryFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final IpScriptFieldScript.LeafFactory leafFactory; + private final IpFieldScript.LeafFactory leafFactory; - public Builder(String name, IpScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, IpFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -41,16 +41,16 @@ public class ScriptIpFieldData extends ScriptBinaryFieldData { } } - private final IpScriptFieldScript.LeafFactory leafFactory; + private final IpFieldScript.LeafFactory leafFactory; - private ScriptIpFieldData(String fieldName, IpScriptFieldScript.LeafFactory leafFactory) { + private ScriptIpFieldData(String fieldName, IpFieldScript.LeafFactory leafFactory) { super(fieldName); this.leafFactory = leafFactory; } @Override public ScriptBinaryLeafFieldData loadDirect(LeafReaderContext context) throws Exception { - IpScriptFieldScript script = leafFactory.newInstance(context); + IpFieldScript script = leafFactory.newInstance(context); return new ScriptBinaryLeafFieldData() { @Override public ScriptDocValues getScriptValues() { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongDocValues.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongDocValues.java index 3f7da9cec5a..52228609363 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongDocValues.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongDocValues.java @@ -7,16 +7,16 @@ package org.elasticsearch.xpack.runtimefields.fielddata; import org.elasticsearch.index.fielddata.AbstractSortedNumericDocValues; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.io.IOException; import java.util.Arrays; public final class ScriptLongDocValues extends AbstractSortedNumericDocValues { - private final AbstractLongScriptFieldScript script; + private final AbstractLongFieldScript script; private int cursor; - ScriptLongDocValues(AbstractLongScriptFieldScript script) { + ScriptLongDocValues(AbstractLongFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongFieldData.java index 7ad3e377d92..0e3017e25ab 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptLongFieldData.java @@ -17,7 +17,7 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.LongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript; import java.io.IOException; @@ -25,9 +25,9 @@ public final class ScriptLongFieldData extends IndexNumericFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final LongScriptFieldScript.LeafFactory leafFactory; + private final LongFieldScript.LeafFactory leafFactory; - public Builder(String name, LongScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, LongFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -39,9 +39,9 @@ public final class ScriptLongFieldData extends IndexNumericFieldData { } private final String fieldName; - private final LongScriptFieldScript.LeafFactory leafFactory; + private final LongFieldScript.LeafFactory leafFactory; - private ScriptLongFieldData(String fieldName, LongScriptFieldScript.LeafFactory leafFactory) { + private ScriptLongFieldData(String fieldName, LongFieldScript.LeafFactory leafFactory) { this.fieldName = fieldName; this.leafFactory = leafFactory; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringDocValues.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringDocValues.java index ada5dcff13e..6e21455756b 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringDocValues.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringDocValues.java @@ -7,14 +7,14 @@ package org.elasticsearch.xpack.runtimefields.fielddata; import org.elasticsearch.index.fielddata.SortingBinaryDocValues; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; public final class ScriptStringDocValues extends SortingBinaryDocValues { - private final StringScriptFieldScript script; + private final StringFieldScript script; - ScriptStringDocValues(StringScriptFieldScript script) { + ScriptStringDocValues(StringFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringFieldData.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringFieldData.java index 6c851a6be85..d8b36d2ab6a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringFieldData.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/fielddata/ScriptStringFieldData.java @@ -15,14 +15,14 @@ import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; public class ScriptStringFieldData extends ScriptBinaryFieldData { public static class Builder implements IndexFieldData.Builder { private final String name; - private final StringScriptFieldScript.LeafFactory leafFactory; + private final StringFieldScript.LeafFactory leafFactory; - public Builder(String name, StringScriptFieldScript.LeafFactory leafFactory) { + public Builder(String name, StringFieldScript.LeafFactory leafFactory) { this.name = name; this.leafFactory = leafFactory; } @@ -33,16 +33,16 @@ public class ScriptStringFieldData extends ScriptBinaryFieldData { } } - private final StringScriptFieldScript.LeafFactory leafFactory; + private final StringFieldScript.LeafFactory leafFactory; - private ScriptStringFieldData(String fieldName, StringScriptFieldScript.LeafFactory leafFactory) { + private ScriptStringFieldData(String fieldName, StringFieldScript.LeafFactory leafFactory) { super(fieldName); this.leafFactory = leafFactory; } @Override public ScriptBinaryLeafFieldData loadDirect(LeafReaderContext context) throws Exception { - StringScriptFieldScript script = leafFactory.newInstance(context); + StringFieldScript script = leafFactory.newInstance(context); return new ScriptBinaryLeafFieldData() { @Override public ScriptDocValues getScriptValues() { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java similarity index 94% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java index 27d3527666b..2b043a6af2f 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.index.fielddata.ScriptDocValues; @@ -27,7 +27,7 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueMillis; * Abstract base for scripts to execute to build scripted fields. Inspired by * {@link AggregationScript} but hopefully with less historical baggage. */ -public abstract class AbstractScriptFieldScript { +public abstract class AbstractFieldScript { /** * The maximum number of values a script should be allowed to emit. */ @@ -64,7 +64,7 @@ public abstract class AbstractScriptFieldScript { private final Map params; private final LeafSearchLookup leafSearchLookup; - public AbstractScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public AbstractFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { this.fieldName = fieldName; this.leafSearchLookup = searchLookup.getLeafSearchLookup(ctx); params = new HashMap<>(params); diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractLongScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java similarity index 84% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractLongScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java index 39a663ed816..76f67fd2a78 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/AbstractLongScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/AbstractLongFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.util.ArrayUtil; @@ -15,11 +15,11 @@ import java.util.Map; /** * Common base class for script field scripts that return long values. */ -public abstract class AbstractLongScriptFieldScript extends AbstractScriptFieldScript { +public abstract class AbstractLongFieldScript extends AbstractFieldScript { private long[] values = new long[1]; private int count; - public AbstractLongScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public AbstractLongFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java similarity index 83% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java index 131d1182df0..cbf010ba7f6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.Booleans; @@ -18,7 +18,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public abstract class BooleanScriptFieldScript extends AbstractScriptFieldScript { +public abstract class BooleanFieldScript extends AbstractFieldScript { public static final ScriptContext CONTEXT = newContext("boolean_script_field", Factory.class); static List whitelist() { @@ -35,13 +35,13 @@ public abstract class BooleanScriptFieldScript extends AbstractScriptFieldScript } public interface LeafFactory { - BooleanScriptFieldScript newInstance(LeafReaderContext ctx); + BooleanFieldScript newInstance(LeafReaderContext ctx); } private int trues; private int falses; - public BooleanScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public BooleanFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } @@ -82,9 +82,9 @@ public abstract class BooleanScriptFieldScript extends AbstractScriptFieldScript } public static class Emit { - private final BooleanScriptFieldScript script; + private final BooleanFieldScript script; - public Emit(BooleanScriptFieldScript script) { + public Emit(BooleanFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DateScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java similarity index 84% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DateScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java index ac5485fafac..764efa99a52 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DateScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DateFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.time.DateFormatter; @@ -20,7 +20,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public abstract class DateScriptFieldScript extends AbstractLongScriptFieldScript { +public abstract class DateFieldScript extends AbstractLongFieldScript { public static final ScriptContext CONTEXT = newContext("date", Factory.class); static List whitelist() { @@ -35,12 +35,12 @@ public abstract class DateScriptFieldScript extends AbstractLongScriptFieldScrip } public interface LeafFactory { - DateScriptFieldScript newInstance(LeafReaderContext ctx); + DateFieldScript newInstance(LeafReaderContext ctx); } private final DateFormatter formatter; - public DateScriptFieldScript( + public DateFieldScript( String fieldName, Map params, SearchLookup searchLookup, @@ -59,9 +59,9 @@ public abstract class DateScriptFieldScript extends AbstractLongScriptFieldScrip } public static class Emit { - private final DateScriptFieldScript script; + private final DateFieldScript script; - public Emit(DateScriptFieldScript script) { + public Emit(DateFieldScript script) { this.script = script; } @@ -71,9 +71,9 @@ public abstract class DateScriptFieldScript extends AbstractLongScriptFieldScrip } public static class Parse { - private final DateScriptFieldScript script; + private final DateFieldScript script; - public Parse(DateScriptFieldScript script) { + public Parse(DateFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DoubleScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java similarity index 85% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DoubleScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java index 38dc4cf09d8..40f3a397b60 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/DoubleScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/DoubleFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.util.ArrayUtil; @@ -18,7 +18,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public abstract class DoubleScriptFieldScript extends AbstractScriptFieldScript { +public abstract class DoubleFieldScript extends AbstractFieldScript { public static final ScriptContext CONTEXT = newContext("double_script_field", Factory.class); static List whitelist() { @@ -35,13 +35,13 @@ public abstract class DoubleScriptFieldScript extends AbstractScriptFieldScript } public interface LeafFactory { - DoubleScriptFieldScript newInstance(LeafReaderContext ctx); + DoubleFieldScript newInstance(LeafReaderContext ctx); } private double[] values = new double[1]; private int count; - public DoubleScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public DoubleFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } @@ -80,9 +80,9 @@ public abstract class DoubleScriptFieldScript extends AbstractScriptFieldScript } public static class Emit { - private final DoubleScriptFieldScript script; + private final DoubleFieldScript script; - public Emit(DoubleScriptFieldScript script) { + public Emit(DoubleFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java similarity index 89% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java index 529b28d9200..1e5408c603a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.index.LeafReaderContext; @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; /** - * Script producing IP addresses. Unlike the other {@linkplain AbstractScriptFieldScript}s + * Script producing IP addresses. Unlike the other {@linkplain AbstractFieldScript}s * which deal with their native java objects this converts its values to the same format * that Lucene uses to store its fields, {@link InetAddressPoint}. There are a few compelling * reasons to do this: @@ -39,7 +39,7 @@ import java.util.Map; * so it saves us a lot of trouble to use the same representation. * */ -public abstract class IpScriptFieldScript extends AbstractScriptFieldScript { +public abstract class IpFieldScript extends AbstractFieldScript { public static final ScriptContext CONTEXT = newContext("ip_script_field", Factory.class); static List whitelist() { @@ -54,13 +54,13 @@ public abstract class IpScriptFieldScript extends AbstractScriptFieldScript { } public interface LeafFactory { - IpScriptFieldScript newInstance(LeafReaderContext ctx); + IpFieldScript newInstance(LeafReaderContext ctx); } private BytesRef[] values = new BytesRef[1]; private int count; - public IpScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public IpFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } @@ -102,9 +102,9 @@ public abstract class IpScriptFieldScript extends AbstractScriptFieldScript { } public static class Emit { - private final IpScriptFieldScript script; + private final IpFieldScript script; - public Emit(IpScriptFieldScript script) { + public Emit(IpFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/LongScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java similarity index 76% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/LongScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java index d546624c3a8..c1a1ea27d9e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/LongScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/LongFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.painless.spi.Whitelist; @@ -17,7 +17,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public abstract class LongScriptFieldScript extends AbstractLongScriptFieldScript { +public abstract class LongFieldScript extends AbstractLongFieldScript { public static final ScriptContext CONTEXT = newContext("long_script_field", Factory.class); static List whitelist() { @@ -32,17 +32,17 @@ public abstract class LongScriptFieldScript extends AbstractLongScriptFieldScrip } public interface LeafFactory { - LongScriptFieldScript newInstance(LeafReaderContext ctx); + LongFieldScript newInstance(LeafReaderContext ctx); } - public LongScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public LongFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } public static class Emit { - private final LongScriptFieldScript script; + private final LongFieldScript script; - public Emit(LongScriptFieldScript script) { + public Emit(LongFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldMapper.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldMapper.java index 023414c4b25..95150aac474 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldMapper.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldMapper.java @@ -24,12 +24,6 @@ import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.DateScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.LongScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; import java.util.List; import java.util.Locale; @@ -91,10 +85,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { static final Map>> FIELD_TYPE_RESOLVER = org.elasticsearch.common.collect.Map.of(BooleanFieldMapper.CONTENT_TYPE, (builder, context) -> { builder.formatAndLocaleNotSupported(); - BooleanScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - BooleanScriptFieldScript.CONTEXT - ); + BooleanFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), BooleanFieldScript.CONTEXT); return new ScriptBooleanMappedFieldType( builder.buildFullName(context), builder.script.getValue(), @@ -102,10 +93,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { builder.meta.getValue() ); }, DateFieldMapper.CONTENT_TYPE, (builder, context) -> { - DateScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - DateScriptFieldScript.CONTEXT - ); + DateFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), DateFieldScript.CONTEXT); String format = builder.format.getValue(); if (format == null) { format = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.pattern(); @@ -124,10 +112,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { ); }, NumberType.DOUBLE.typeName(), (builder, context) -> { builder.formatAndLocaleNotSupported(); - DoubleScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - DoubleScriptFieldScript.CONTEXT - ); + DoubleFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), DoubleFieldScript.CONTEXT); return new ScriptDoubleMappedFieldType( builder.buildFullName(context), builder.script.getValue(), @@ -136,10 +121,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { ); }, IpFieldMapper.CONTENT_TYPE, (builder, context) -> { builder.formatAndLocaleNotSupported(); - IpScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - IpScriptFieldScript.CONTEXT - ); + IpFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), IpFieldScript.CONTEXT); return new ScriptIpMappedFieldType( builder.buildFullName(context), builder.script.getValue(), @@ -148,10 +130,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { ); }, KeywordFieldMapper.CONTENT_TYPE, (builder, context) -> { builder.formatAndLocaleNotSupported(); - StringScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - StringScriptFieldScript.CONTEXT - ); + StringFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), StringFieldScript.CONTEXT); return new ScriptKeywordMappedFieldType( builder.buildFullName(context), builder.script.getValue(), @@ -160,10 +139,7 @@ public final class RuntimeFieldMapper extends ParametrizedFieldMapper { ); }, NumberType.LONG.typeName(), (builder, context) -> { builder.formatAndLocaleNotSupported(); - LongScriptFieldScript.Factory factory = builder.scriptCompiler.compile( - builder.script.getValue(), - LongScriptFieldScript.CONTEXT - ); + LongFieldScript.Factory factory = builder.scriptCompiler.compile(builder.script.getValue(), LongFieldScript.CONTEXT); return new ScriptLongMappedFieldType( builder.buildFullName(context), builder.script.getValue(), diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFieldsPainlessExtension.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java similarity index 53% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFieldsPainlessExtension.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java index 5d82c5935ff..43d2795f5a8 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/RuntimeFieldsPainlessExtension.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/RuntimeFieldsPainlessExtension.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.elasticsearch.painless.spi.PainlessExtension; import org.elasticsearch.painless.spi.Whitelist; @@ -17,18 +17,18 @@ public class RuntimeFieldsPainlessExtension implements PainlessExtension { @Override public Map, List> getContextWhitelists() { return org.elasticsearch.common.collect.Map.of( - BooleanScriptFieldScript.CONTEXT, - BooleanScriptFieldScript.whitelist(), - DateScriptFieldScript.CONTEXT, - DateScriptFieldScript.whitelist(), - DoubleScriptFieldScript.CONTEXT, - DoubleScriptFieldScript.whitelist(), - IpScriptFieldScript.CONTEXT, - IpScriptFieldScript.whitelist(), - LongScriptFieldScript.CONTEXT, - LongScriptFieldScript.whitelist(), - StringScriptFieldScript.CONTEXT, - StringScriptFieldScript.whitelist() + BooleanFieldScript.CONTEXT, + BooleanFieldScript.whitelist(), + DateFieldScript.CONTEXT, + DateFieldScript.whitelist(), + DoubleFieldScript.CONTEXT, + DoubleFieldScript.whitelist(), + IpFieldScript.CONTEXT, + IpFieldScript.whitelist(), + LongFieldScript.CONTEXT, + LongFieldScript.whitelist(), + StringFieldScript.CONTEXT, + StringFieldScript.whitelist() ); } } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldType.java index 4f97401c084..48cf0d60062 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldType.java @@ -17,7 +17,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptBooleanFieldData; import org.elasticsearch.xpack.runtimefields.query.BooleanScriptFieldExistsQuery; import org.elasticsearch.xpack.runtimefields.query.BooleanScriptFieldTermQuery; @@ -27,8 +26,8 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -public class ScriptBooleanMappedFieldType extends AbstractScriptMappedFieldType { - ScriptBooleanMappedFieldType(String name, Script script, BooleanScriptFieldScript.Factory scriptFactory, Map meta) { +public class ScriptBooleanMappedFieldType extends AbstractScriptMappedFieldType { + ScriptBooleanMappedFieldType(String name, Script script, BooleanFieldScript.Factory scriptFactory, Map meta) { super(name, script, scriptFactory::newFactory, meta); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldType.java index 8257723a836..a1846b89ce8 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldType.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; - import org.apache.lucene.search.Query; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.lucene.search.Queries; @@ -22,7 +21,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.DateScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptDateFieldData; import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldDistanceFeatureQuery; import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldExistsQuery; @@ -37,13 +35,13 @@ import java.util.Locale; import java.util.Map; import java.util.function.Supplier; -public class ScriptDateMappedFieldType extends AbstractScriptMappedFieldType { +public class ScriptDateMappedFieldType extends AbstractScriptMappedFieldType { private final DateFormatter dateTimeFormatter; ScriptDateMappedFieldType( String name, Script script, - DateScriptFieldScript.Factory scriptFactory, + DateFieldScript.Factory scriptFactory, DateFormatter dateTimeFormatter, Map meta ) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldType.java index 0cd6313d3d5..6f420de7d3e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldType.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; - import org.apache.lucene.search.Query; import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.time.DateMathParser; @@ -17,7 +16,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptDoubleFieldData; import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldExistsQuery; import org.elasticsearch.xpack.runtimefields.query.DoubleScriptFieldRangeQuery; @@ -29,8 +27,8 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -public class ScriptDoubleMappedFieldType extends AbstractScriptMappedFieldType { - ScriptDoubleMappedFieldType(String name, Script script, DoubleScriptFieldScript.Factory scriptFactory, Map meta) { +public class ScriptDoubleMappedFieldType extends AbstractScriptMappedFieldType { + ScriptDoubleMappedFieldType(String name, Script script, DoubleFieldScript.Factory scriptFactory, Map meta) { super(name, script, scriptFactory::newFactory, meta); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldType.java index eaf9940e65d..f972ea23c56 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldType.java @@ -22,7 +22,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptIpFieldData; import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldExistsQuery; import org.elasticsearch.xpack.runtimefields.query.IpScriptFieldRangeQuery; @@ -37,8 +36,8 @@ import java.util.Locale; import java.util.Map; import java.util.function.Supplier; -public final class ScriptIpMappedFieldType extends AbstractScriptMappedFieldType { - ScriptIpMappedFieldType(String name, Script script, IpScriptFieldScript.Factory scriptFactory, Map meta) { +public final class ScriptIpMappedFieldType extends AbstractScriptMappedFieldType { + ScriptIpMappedFieldType(String name, Script script, IpFieldScript.Factory scriptFactory, Map meta) { super(name, script, scriptFactory::newFactory, meta); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldType.java index 7cf7a5be595..bd6ce81c112 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldType.java @@ -16,7 +16,6 @@ import org.elasticsearch.index.mapper.KeywordFieldMapper; import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptStringFieldData; import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldExistsQuery; import org.elasticsearch.xpack.runtimefields.query.StringScriptFieldFuzzyQuery; @@ -36,8 +35,8 @@ import java.util.function.Supplier; import static java.util.stream.Collectors.toSet; -public final class ScriptKeywordMappedFieldType extends AbstractScriptMappedFieldType { - ScriptKeywordMappedFieldType(String name, Script script, StringScriptFieldScript.Factory scriptFactory, Map meta) { +public final class ScriptKeywordMappedFieldType extends AbstractScriptMappedFieldType { + ScriptKeywordMappedFieldType(String name, Script script, StringFieldScript.Factory scriptFactory, Map meta) { super(name, script, scriptFactory::newFactory, meta); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldType.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldType.java index 2f4a44bc3fe..fb9cfb01057 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldType.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldType.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.runtimefields.mapper; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; - import org.apache.lucene.search.Query; import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.time.DateMathParser; @@ -17,7 +16,6 @@ import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.script.Script; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.lookup.SearchLookup; -import org.elasticsearch.xpack.runtimefields.LongScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptLongFieldData; import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldExistsQuery; import org.elasticsearch.xpack.runtimefields.query.LongScriptFieldRangeQuery; @@ -29,8 +27,8 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -public class ScriptLongMappedFieldType extends AbstractScriptMappedFieldType { - ScriptLongMappedFieldType(String name, Script script, LongScriptFieldScript.Factory scriptFactory, Map meta) { +public class ScriptLongMappedFieldType extends AbstractScriptMappedFieldType { + ScriptLongMappedFieldType(String name, Script script, LongFieldScript.Factory scriptFactory, Map meta) { super(name, script, scriptFactory::newFactory, meta); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScript.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java similarity index 86% rename from x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScript.java rename to x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java index 861b0daec6b..d23e97d0101 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScript.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScript.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.painless.spi.Whitelist; @@ -19,7 +19,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; -public abstract class StringScriptFieldScript extends AbstractScriptFieldScript { +public abstract class StringFieldScript extends AbstractFieldScript { /** * The maximum number of chars a script should be allowed to emit. */ @@ -41,13 +41,13 @@ public abstract class StringScriptFieldScript extends AbstractScriptFieldScript } public interface LeafFactory { - StringScriptFieldScript newInstance(LeafReaderContext ctx); + StringFieldScript newInstance(LeafReaderContext ctx); } private final List results = new ArrayList<>(); private long chars; - public StringScriptFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { + public StringFieldScript(String fieldName, Map params, SearchLookup searchLookup, LeafReaderContext ctx) { super(fieldName, params, searchLookup, ctx); } @@ -83,9 +83,9 @@ public abstract class StringScriptFieldScript extends AbstractScriptFieldScript } public static class Emit { - private final StringScriptFieldScript script; + private final StringFieldScript script; - public Emit(StringScriptFieldScript script) { + public Emit(StringFieldScript script) { this.script = script; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java index 060e733903c..1bb6c7081cc 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractBooleanScriptFieldQuery.java @@ -8,20 +8,20 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.search.QueryVisitor; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; /** - * Abstract base class for building queries based on {@link DoubleScriptFieldScript}. + * Abstract base class for building queries based on {@link DoubleFieldScript}. */ -abstract class AbstractBooleanScriptFieldQuery extends AbstractScriptFieldQuery { +abstract class AbstractBooleanScriptFieldQuery extends AbstractScriptFieldQuery { - AbstractBooleanScriptFieldQuery(Script script, BooleanScriptFieldScript.LeafFactory leafFactory, String fieldName) { + AbstractBooleanScriptFieldQuery(Script script, BooleanFieldScript.LeafFactory leafFactory, String fieldName) { super(script, fieldName, leafFactory::newInstance); } @Override - protected boolean matches(BooleanScriptFieldScript scriptContext, int docId) { + protected boolean matches(BooleanFieldScript scriptContext, int docId) { scriptContext.runForDoc(docId); return matches(scriptContext.trues(), scriptContext.falses()); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java index dacc337a8fa..35db1eb7a78 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQuery.java @@ -8,19 +8,19 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.search.QueryVisitor; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; /** - * Abstract base class for building queries based on {@link DoubleScriptFieldScript}. + * Abstract base class for building queries based on {@link DoubleFieldScript}. */ -abstract class AbstractDoubleScriptFieldQuery extends AbstractScriptFieldQuery { +abstract class AbstractDoubleScriptFieldQuery extends AbstractScriptFieldQuery { - AbstractDoubleScriptFieldQuery(Script script, DoubleScriptFieldScript.LeafFactory leafFactory, String fieldName) { + AbstractDoubleScriptFieldQuery(Script script, DoubleFieldScript.LeafFactory leafFactory, String fieldName) { super(script, fieldName, leafFactory::newInstance); } @Override - protected boolean matches(DoubleScriptFieldScript scriptContext, int docId) { + protected boolean matches(DoubleFieldScript scriptContext, int docId) { scriptContext.runForDoc(docId); return matches(scriptContext.values(), scriptContext.count()); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java index 15b18cf7e9c..d55b6bdd647 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQuery.java @@ -11,22 +11,22 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.net.InetAddress; /** - * Abstract base class for building queries based on {@link StringScriptFieldScript}. + * Abstract base class for building queries based on {@link StringFieldScript}. */ -abstract class AbstractIpScriptFieldQuery extends AbstractScriptFieldQuery { +abstract class AbstractIpScriptFieldQuery extends AbstractScriptFieldQuery { - AbstractIpScriptFieldQuery(Script script, IpScriptFieldScript.LeafFactory leafFactory, String fieldName) { + AbstractIpScriptFieldQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName) { super(script, fieldName, leafFactory::newInstance); } @Override - protected boolean matches(IpScriptFieldScript scriptContext, int docId) { + protected boolean matches(IpFieldScript scriptContext, int docId) { scriptContext.runForDoc(docId); return matches(scriptContext.values(), scriptContext.count()); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java index 9b5c9c06be8..d8e2d89d4e6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQuery.java @@ -9,25 +9,25 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.QueryVisitor; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; /** - * Abstract base class for building queries based on {@link AbstractLongScriptFieldScript}. + * Abstract base class for building queries based on {@link AbstractLongFieldScript}. */ -abstract class AbstractLongScriptFieldQuery extends AbstractScriptFieldQuery { +abstract class AbstractLongScriptFieldQuery extends AbstractScriptFieldQuery { AbstractLongScriptFieldQuery( Script script, - Function scriptContextFunction, + Function scriptContextFunction, String fieldName ) { super(script, fieldName, scriptContextFunction); } @Override - protected boolean matches(AbstractLongScriptFieldScript scriptContext, int docId) { + protected boolean matches(AbstractLongFieldScript scriptContext, int docId) { scriptContext.runForDoc(docId); return AbstractLongScriptFieldQuery.this.matches(scriptContext.values(), scriptContext.count()); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java index 3a994da235d..dc4c0ec318a 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractScriptFieldQuery.java @@ -17,7 +17,7 @@ import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractFieldScript; import java.io.IOException; import java.util.Objects; @@ -26,7 +26,7 @@ import java.util.function.Function; /** * Abstract base class for building queries based on script fields. */ -abstract class AbstractScriptFieldQuery extends Query { +abstract class AbstractScriptFieldQuery extends Query { /** * We don't have the infrastructure to estimate the match cost of a script * so we just use a big number. diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java index 18d7450ca17..0be75705b4c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldAutomatonQuery.java @@ -10,7 +10,7 @@ import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; @@ -20,7 +20,7 @@ public abstract class AbstractStringScriptFieldAutomatonQuery extends AbstractSt public AbstractStringScriptFieldAutomatonQuery( Script script, - StringScriptFieldScript.LeafFactory leafFactory, + StringFieldScript.LeafFactory leafFactory, String fieldName, ByteRunAutomaton automaton ) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java index 6a14019c70a..eec8cf8980e 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQuery.java @@ -7,21 +7,21 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; /** - * Abstract base class for building queries based on {@link StringScriptFieldScript}. + * Abstract base class for building queries based on {@link StringFieldScript}. */ -abstract class AbstractStringScriptFieldQuery extends AbstractScriptFieldQuery { +abstract class AbstractStringScriptFieldQuery extends AbstractScriptFieldQuery { - AbstractStringScriptFieldQuery(Script script, StringScriptFieldScript.LeafFactory leafFactory, String fieldName) { + AbstractStringScriptFieldQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName) { super(script, fieldName, leafFactory::newInstance); } @Override - protected final boolean matches(StringScriptFieldScript scriptContext, int docId) { + protected final boolean matches(StringFieldScript scriptContext, int docId) { return matches(scriptContext.resultsForDoc(docId)); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java index ec3690db3e3..a076394ef02 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldExistsQuery.java @@ -7,10 +7,10 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; public class BooleanScriptFieldExistsQuery extends AbstractBooleanScriptFieldQuery { - public BooleanScriptFieldExistsQuery(Script script, BooleanScriptFieldScript.LeafFactory leafFactory, String fieldName) { + public BooleanScriptFieldExistsQuery(Script script, BooleanFieldScript.LeafFactory leafFactory, String fieldName) { super(script, leafFactory, fieldName); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java index 6247be54e3e..5f8ce125748 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/BooleanScriptFieldTermQuery.java @@ -7,14 +7,14 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript; import java.util.Objects; public class BooleanScriptFieldTermQuery extends AbstractBooleanScriptFieldQuery { private final boolean term; - public BooleanScriptFieldTermQuery(Script script, BooleanScriptFieldScript.LeafFactory leafFactory, String fieldName, boolean term) { + public BooleanScriptFieldTermQuery(Script script, BooleanFieldScript.LeafFactory leafFactory, String fieldName, boolean term) { super(script, leafFactory, fieldName); this.term = term; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java index 620b6569457..7392023593d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldExistsQuery.java @@ -7,10 +7,10 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; public class DoubleScriptFieldExistsQuery extends AbstractDoubleScriptFieldQuery { - public DoubleScriptFieldExistsQuery(Script script, DoubleScriptFieldScript.LeafFactory leafFactory, String fieldName) { + public DoubleScriptFieldExistsQuery(Script script, DoubleFieldScript.LeafFactory leafFactory, String fieldName) { super(script, leafFactory, fieldName); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java index 8bb407d3902..6fc4128a32d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldRangeQuery.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Objects; @@ -17,7 +17,7 @@ public class DoubleScriptFieldRangeQuery extends AbstractDoubleScriptFieldQuery public DoubleScriptFieldRangeQuery( Script script, - DoubleScriptFieldScript.LeafFactory leafFactory, + DoubleFieldScript.LeafFactory leafFactory, String fieldName, double lowerValue, double upperValue diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java index 2949aee7888..3593b49699b 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermQuery.java @@ -7,14 +7,14 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Objects; public class DoubleScriptFieldTermQuery extends AbstractDoubleScriptFieldQuery { private final double term; - public DoubleScriptFieldTermQuery(Script script, DoubleScriptFieldScript.LeafFactory leafFactory, String fieldName, double term) { + public DoubleScriptFieldTermQuery(Script script, DoubleFieldScript.LeafFactory leafFactory, String fieldName, double term) { super(script, leafFactory, fieldName); this.term = term; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java index 990430807e7..f724f150c11 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQuery.java @@ -9,9 +9,8 @@ package org.elasticsearch.xpack.runtimefields.query; import com.carrotsearch.hppc.LongSet; import com.carrotsearch.hppc.cursors.LongCursor; - import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import java.util.Arrays; import java.util.Objects; @@ -23,7 +22,7 @@ public class DoubleScriptFieldTermsQuery extends AbstractDoubleScriptFieldQuery * Build the query. * @param terms The terms converted to a long with {@link Double#doubleToLongBits(double)}. */ - public DoubleScriptFieldTermsQuery(Script script, DoubleScriptFieldScript.LeafFactory leafFactory, String fieldName, LongSet terms) { + public DoubleScriptFieldTermsQuery(Script script, DoubleFieldScript.LeafFactory leafFactory, String fieldName, LongSet terms) { super(script, leafFactory, fieldName); this.terms = terms; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java index 423c557ccb7..3a0bfa4d0ee 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldExistsQuery.java @@ -8,10 +8,10 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; public class IpScriptFieldExistsQuery extends AbstractIpScriptFieldQuery { - public IpScriptFieldExistsQuery(Script script, IpScriptFieldScript.LeafFactory leafFactory, String fieldName) { + public IpScriptFieldExistsQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName) { super(script, leafFactory, fieldName); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java index 8257401d655..3c74f1637db 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldRangeQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; import java.util.Objects; @@ -18,13 +18,7 @@ public class IpScriptFieldRangeQuery extends AbstractIpScriptFieldQuery { private final BytesRef lower; private final BytesRef upper; - public IpScriptFieldRangeQuery( - Script script, - IpScriptFieldScript.LeafFactory leafFactory, - String fieldName, - BytesRef lower, - BytesRef upper - ) { + public IpScriptFieldRangeQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName, BytesRef lower, BytesRef upper) { super(script, leafFactory, fieldName); this.lower = lower; this.upper = upper; diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java index 6ddc264a624..7a6a326f3bf 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; import java.util.Objects; @@ -17,7 +17,7 @@ import java.util.Objects; public class IpScriptFieldTermQuery extends AbstractIpScriptFieldQuery { private final BytesRef term; - public IpScriptFieldTermQuery(Script script, IpScriptFieldScript.LeafFactory leafFactory, String fieldName, BytesRef term) { + public IpScriptFieldTermQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName, BytesRef term) { super(script, leafFactory, fieldName); this.term = term; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java index a808fb6d8ef..43066c4446b 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/IpScriptFieldTermsQuery.java @@ -10,14 +10,14 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.util.Objects; public class IpScriptFieldTermsQuery extends AbstractIpScriptFieldQuery { private final BytesRefHash terms; - public IpScriptFieldTermsQuery(Script script, IpScriptFieldScript.LeafFactory leafFactory, String fieldName, BytesRefHash terms) { + public IpScriptFieldTermsQuery(Script script, IpFieldScript.LeafFactory leafFactory, String fieldName, BytesRefHash terms) { super(script, leafFactory, fieldName); this.terms = terms; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java index e5b947eff47..b8e56ad141d 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQuery.java @@ -17,21 +17,21 @@ import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.io.IOException; import java.util.Objects; import java.util.Set; import java.util.function.Function; -public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFieldQuery { +public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFieldQuery { private final long origin; private final long pivot; private final float boost; public LongScriptFieldDistanceFeatureQuery( Script script, - Function leafFactory, + Function leafFactory, String fieldName, long origin, long pivot, @@ -44,7 +44,7 @@ public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFie } @Override - protected boolean matches(AbstractLongScriptFieldScript scriptContext, int docId) { + protected boolean matches(AbstractLongFieldScript scriptContext, int docId) { scriptContext.runForDoc(docId); return scriptContext.count() > 0; } @@ -67,7 +67,7 @@ public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFie @Override public Explanation explain(LeafReaderContext context, int doc) { - AbstractLongScriptFieldScript script = scriptContextFunction().apply(context); + AbstractLongFieldScript script = scriptContextFunction().apply(context); script.runForDoc(doc); long value = valueWithMinAbsoluteDistance(script); float weight = LongScriptFieldDistanceFeatureQuery.this.boost * boost; @@ -85,12 +85,12 @@ public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFie } private class DistanceScorer extends Scorer { - private final AbstractLongScriptFieldScript script; + private final AbstractLongFieldScript script; private final TwoPhaseIterator twoPhase; private final DocIdSetIterator disi; private final float weight; - protected DistanceScorer(Weight weight, AbstractLongScriptFieldScript script, int maxDoc, float boost) { + protected DistanceScorer(Weight weight, AbstractLongFieldScript script, int maxDoc, float boost) { super(weight); this.script = script; twoPhase = new TwoPhaseIterator(DocIdSetIterator.all(maxDoc)) { @@ -137,7 +137,7 @@ public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFie } } - long minAbsoluteDistance(AbstractLongScriptFieldScript script) { + long minAbsoluteDistance(AbstractLongFieldScript script) { long minDistance = Long.MAX_VALUE; for (int i = 0; i < script.count(); i++) { minDistance = Math.min(minDistance, distanceFor(script.values()[i])); @@ -145,7 +145,7 @@ public final class LongScriptFieldDistanceFeatureQuery extends AbstractScriptFie return minDistance; } - long valueWithMinAbsoluteDistance(AbstractLongScriptFieldScript script) { + long valueWithMinAbsoluteDistance(AbstractLongFieldScript script) { long minDistance = Long.MAX_VALUE; long minDistanceValue = Long.MAX_VALUE; for (int i = 0; i < script.count(); i++) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java index 7289fc68043..c2f2388410c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldExistsQuery.java @@ -8,16 +8,12 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; public class LongScriptFieldExistsQuery extends AbstractLongScriptFieldQuery { - public LongScriptFieldExistsQuery( - Script script, - Function leafFactory, - String fieldName - ) { + public LongScriptFieldExistsQuery(Script script, Function leafFactory, String fieldName) { super(script, leafFactory, fieldName); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java index ce72cc22e60..046faf7a0b3 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldRangeQuery.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; @@ -19,7 +19,7 @@ public class LongScriptFieldRangeQuery extends AbstractLongScriptFieldQuery { public LongScriptFieldRangeQuery( Script script, - Function leafFactory, + Function leafFactory, String fieldName, long lowerValue, long upperValue diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java index 66023e631c6..f97d4a215e6 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermQuery.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; @@ -18,7 +18,7 @@ public class LongScriptFieldTermQuery extends AbstractLongScriptFieldQuery { public LongScriptFieldTermQuery( Script script, - Function leafFactory, + Function leafFactory, String fieldName, long term ) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java index b8039327df1..08998d3475b 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldTermsQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import com.carrotsearch.hppc.LongSet; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.Objects; import java.util.function.Function; @@ -19,7 +19,7 @@ public class LongScriptFieldTermsQuery extends AbstractLongScriptFieldQuery { public LongScriptFieldTermsQuery( Script script, - Function leafFactory, + Function leafFactory, String fieldName, LongSet terms ) { diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java index 9f1ae5f110c..64eb59de629 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldExistsQuery.java @@ -7,12 +7,12 @@ package org.elasticsearch.xpack.runtimefields.query; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; public class StringScriptFieldExistsQuery extends AbstractStringScriptFieldQuery { - public StringScriptFieldExistsQuery(Script script, StringScriptFieldScript.LeafFactory leafFactory, String fieldName) { + public StringScriptFieldExistsQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName) { super(script, leafFactory, fieldName); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java index ac409c74772..a44f6db651b 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldFuzzyQuery.java @@ -10,14 +10,14 @@ import org.apache.lucene.index.Term; import org.apache.lucene.search.FuzzyQuery; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; public class StringScriptFieldFuzzyQuery extends AbstractStringScriptFieldAutomatonQuery { public static StringScriptFieldFuzzyQuery build( Script script, - StringScriptFieldScript.LeafFactory leafFactory, + StringFieldScript.LeafFactory leafFactory, String fieldName, String term, int maxEdits, @@ -34,7 +34,7 @@ public class StringScriptFieldFuzzyQuery extends AbstractStringScriptFieldAutoma private StringScriptFieldFuzzyQuery( Script script, - StringScriptFieldScript.LeafFactory leafFactory, + StringFieldScript.LeafFactory leafFactory, String fieldName, ByteRunAutomaton automaton, FuzzyQuery delegate diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java index e9c3f8b19a8..1f46872bea0 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldPrefixQuery.java @@ -11,7 +11,7 @@ import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; @@ -19,7 +19,7 @@ import java.util.Objects; public class StringScriptFieldPrefixQuery extends AbstractStringScriptFieldQuery { private final String prefix; - public StringScriptFieldPrefixQuery(Script script, StringScriptFieldScript.LeafFactory leafFactory, String fieldName, String prefix) { + public StringScriptFieldPrefixQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName, String prefix) { super(script, leafFactory, fieldName); this.prefix = Objects.requireNonNull(prefix); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java index acd5b051361..08085f34c84 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRangeQuery.java @@ -11,7 +11,7 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.automaton.Automata; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; @@ -24,7 +24,7 @@ public class StringScriptFieldRangeQuery extends AbstractStringScriptFieldQuery public StringScriptFieldRangeQuery( Script script, - StringScriptFieldScript.LeafFactory leafFactory, + StringFieldScript.LeafFactory leafFactory, String fieldName, String lowerValue, String upperValue, diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java index 893add56381..79eb10b22ba 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldRegexpQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.apache.lucene.util.automaton.RegExp; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; @@ -19,7 +19,7 @@ public class StringScriptFieldRegexpQuery extends AbstractStringScriptFieldAutom public StringScriptFieldRegexpQuery( Script script, - StringScriptFieldScript.LeafFactory leafFactory, + StringFieldScript.LeafFactory leafFactory, String fieldName, String pattern, int flags, diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java index ba8650b966b..a3b3762d1e9 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.QueryVisitor; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; @@ -17,7 +17,7 @@ import java.util.Objects; public class StringScriptFieldTermQuery extends AbstractStringScriptFieldQuery { private final String term; - public StringScriptFieldTermQuery(Script script, StringScriptFieldScript.LeafFactory leafFactory, String fieldName, String term) { + public StringScriptFieldTermQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName, String term) { super(script, leafFactory, fieldName); this.term = Objects.requireNonNull(term); } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java index e5efa08c102..f09edaf1bf8 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldTermsQuery.java @@ -9,7 +9,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.Term; import org.apache.lucene.search.QueryVisitor; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.List; import java.util.Objects; @@ -18,12 +18,7 @@ import java.util.Set; public class StringScriptFieldTermsQuery extends AbstractStringScriptFieldQuery { private final Set terms; - public StringScriptFieldTermsQuery( - Script script, - StringScriptFieldScript.LeafFactory leafFactory, - String fieldName, - Set terms - ) { + public StringScriptFieldTermsQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName, Set terms) { super(script, leafFactory, fieldName); this.terms = terms; } diff --git a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java index 2e342adb5cf..17f671aa18c 100644 --- a/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java +++ b/x-pack/plugin/runtime-fields/src/main/java/org/elasticsearch/xpack/runtimefields/query/StringScriptFieldWildcardQuery.java @@ -10,19 +10,14 @@ import org.apache.lucene.index.Term; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.automaton.ByteRunAutomaton; import org.elasticsearch.script.Script; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.Objects; public class StringScriptFieldWildcardQuery extends AbstractStringScriptFieldAutomatonQuery { private final String pattern; - public StringScriptFieldWildcardQuery( - Script script, - StringScriptFieldScript.LeafFactory leafFactory, - String fieldName, - String pattern - ) { + public StringScriptFieldWildcardQuery(Script script, StringFieldScript.LeafFactory leafFactory, String fieldName, String pattern) { super( script, leafFactory, diff --git a/x-pack/plugin/runtime-fields/src/main/resources/META-INF/services/org.elasticsearch.painless.spi.PainlessExtension b/x-pack/plugin/runtime-fields/src/main/resources/META-INF/services/org.elasticsearch.painless.spi.PainlessExtension index cd804b8d8f6..6f810cb59c5 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/META-INF/services/org.elasticsearch.painless.spi.PainlessExtension +++ b/x-pack/plugin/runtime-fields/src/main/resources/META-INF/services/org.elasticsearch.painless.spi.PainlessExtension @@ -1 +1 @@ -org.elasticsearch.xpack.runtimefields.RuntimeFieldsPainlessExtension \ No newline at end of file +org.elasticsearch.xpack.runtimefields.mapper.RuntimeFieldsPainlessExtension diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/boolean_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt similarity index 59% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/boolean_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt index d7dd121e4dc..7a25fb3984a 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/boolean_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/boolean_whitelist.txt @@ -7,15 +7,15 @@ # The whitelist for boolean-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript$Factory @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.BooleanScriptFieldScript, boolean) bound_to org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript$Emit + void emit(org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript, boolean) bound_to org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript$Emit # Parse a value from the source to a boolean - boolean parse(def) from_class org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript + boolean parse(def) from_class org.elasticsearch.xpack.runtimefields.mapper.BooleanFieldScript } diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/date_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt similarity index 53% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/date_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt index 0f4476ad623..618182b1ff0 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/date_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/date_whitelist.txt @@ -7,18 +7,18 @@ # The whitelist for date-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.DateScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.DateScriptFieldScript$Factory @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.DateScriptFieldScript, long) bound_to org.elasticsearch.xpack.runtimefields.DateScriptFieldScript$Emit + 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.DateScriptFieldScript, def) bound_to org.elasticsearch.xpack.runtimefields.DateScriptFieldScript$Parse + long parse(org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript, def) bound_to org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript$Parse # Add an easy method to convert temporalAccessors to millis since epoch. - long toEpochMilli(java.time.temporal.TemporalAccessor) from_class org.elasticsearch.xpack.runtimefields.DateScriptFieldScript + long toEpochMilli(java.time.temporal.TemporalAccessor) from_class org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript } diff --git a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/double_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt similarity index 56% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/double_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt index 7b32499f512..626f1d7b7fb 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/double_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/double_whitelist.txt @@ -7,13 +7,13 @@ # The whitelist for double-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript$Factory @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.DoubleScriptFieldScript, double) bound_to org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript$Emit + 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/ip_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt similarity index 57% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/ip_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt index 07b9ec0c793..f6b7d2b2219 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/ip_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/ip_whitelist.txt @@ -7,12 +7,12 @@ # The whitelist for ip-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.IpScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.IpScriptFieldScript$Factory @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.IpScriptFieldScript, String) bound_to org.elasticsearch.xpack.runtimefields.IpScriptFieldScript$Emit + 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/long_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt similarity index 57% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/long_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt index 4710044bf75..a0c399fc6de 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/long_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/long_whitelist.txt @@ -7,12 +7,12 @@ # The whitelist for long-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.LongScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.LongFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.LongScriptFieldScript$Factory @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.LongScriptFieldScript, long) bound_to org.elasticsearch.xpack.runtimefields.LongScriptFieldScript$Emit + 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/string_whitelist.txt b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt similarity index 56% rename from x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/string_whitelist.txt rename to x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt index 12b7b850776..d4ea8794be1 100644 --- a/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/string_whitelist.txt +++ b/x-pack/plugin/runtime-fields/src/main/resources/org/elasticsearch/xpack/runtimefields/mapper/string_whitelist.txt @@ -7,12 +7,12 @@ # The whitelist for string-valued runtime fields # These two whitelists are required for painless to find the classes -class org.elasticsearch.xpack.runtimefields.StringScriptFieldScript @no_import { +class org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript @no_import { } -class org.elasticsearch.xpack.runtimefields.StringScriptFieldScript$Factory @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.StringScriptFieldScript, String) bound_to org.elasticsearch.xpack.runtimefields.StringScriptFieldScript$Emit + void emit(org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript, String) bound_to org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript$Emit } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScriptTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java similarity index 73% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScriptTests.java rename to x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java index 698d30f5d74..30c804fa242 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/BooleanScriptFieldScriptTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/BooleanFieldScriptTests.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -19,8 +19,8 @@ import java.io.IOException; import static org.mockito.Mockito.mock; -public class BooleanScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final BooleanScriptFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new BooleanScriptFieldScript( +public class BooleanFieldScriptTests extends FieldScriptTestCase { + public static final BooleanFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new BooleanFieldScript( fieldName, params, lookup, @@ -33,12 +33,12 @@ public class BooleanScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return BooleanScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return BooleanFieldScript.CONTEXT; } @Override - protected BooleanScriptFieldScript.Factory dummyScript() { + protected BooleanFieldScript.Factory dummyScript() { return DUMMY; } @@ -46,7 +46,7 @@ public class BooleanScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -54,7 +54,7 @@ public class BooleanScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final DateScriptFieldScript.Factory DUMMY = (fieldName, params, lookup, formatter) -> ctx -> new DateScriptFieldScript( +public class DateFieldScriptTests extends FieldScriptTestCase { + public static final DateFieldScript.Factory DUMMY = (fieldName, params, lookup, formatter) -> ctx -> new DateFieldScript( fieldName, params, lookup, @@ -36,12 +36,12 @@ public class DateScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return DateScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return DateFieldScript.CONTEXT; } @Override - protected DateScriptFieldScript.Factory dummyScript() { + protected DateFieldScript.Factory dummyScript() { return DUMMY; } @@ -49,7 +49,7 @@ public class DateScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -58,7 +58,7 @@ public class DateScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final DoubleScriptFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new DoubleScriptFieldScript( +public class DoubleFieldScriptTests extends FieldScriptTestCase { + public static final DoubleFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new DoubleFieldScript( fieldName, params, lookup, @@ -34,12 +34,12 @@ public class DoubleScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return DoubleScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return DoubleFieldScript.CONTEXT; } @Override - protected DoubleScriptFieldScript.Factory dummyScript() { + protected DoubleFieldScript.Factory dummyScript() { return DUMMY; } @@ -47,7 +47,7 @@ public class DoubleScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -55,7 +55,7 @@ public class DoubleScriptFieldScriptTests extends ScriptFieldScriptTestCase extends ESTestCase { +public abstract class FieldScriptTestCase extends ESTestCase { protected abstract ScriptContext context(); protected abstract T dummyScript(); diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScriptTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java similarity index 77% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScriptTests.java rename to x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java index 588a7a2b596..3eb93435000 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/IpScriptFieldScriptTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/IpFieldScriptTests.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -20,8 +20,8 @@ import java.io.IOException; import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.mock; -public class IpScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final IpScriptFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new IpScriptFieldScript( +public class IpFieldScriptTests extends FieldScriptTestCase { + public static final IpFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new IpFieldScript( fieldName, params, lookup, @@ -34,12 +34,12 @@ public class IpScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return IpScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return IpFieldScript.CONTEXT; } @Override - protected IpScriptFieldScript.Factory dummyScript() { + protected IpFieldScript.Factory dummyScript() { return DUMMY; } @@ -47,7 +47,7 @@ public class IpScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -55,7 +55,7 @@ public class IpScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final LongScriptFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new LongScriptFieldScript( +public class LongFieldScriptTests extends FieldScriptTestCase { + public static final LongFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new LongFieldScript( fieldName, params, lookup, @@ -34,12 +34,12 @@ public class LongScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return LongScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return LongFieldScript.CONTEXT; } @Override - protected LongScriptFieldScript.Factory dummyScript() { + protected LongFieldScript.Factory dummyScript() { return DUMMY; } @@ -47,7 +47,7 @@ public class LongScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -55,7 +55,7 @@ public class LongScriptFieldScriptTests extends ScriptFieldScriptTestCase new ScriptKeywordMappedFieldType( field, new Script(""), - mock(StringScriptFieldScript.Factory.class), + mock(StringFieldScript.Factory.class), Collections.emptyMap() ), (fieldType, searchLookupSupplier) -> indexFieldDataService.getForField(fieldType, "index", searchLookupSupplier) @@ -372,35 +359,35 @@ public class RuntimeFieldMapperTests extends MapperTestCase { return new TestScriptEngine() { @Override protected Object buildScriptFactory(ScriptContext context) { - if (context == BooleanScriptFieldScript.CONTEXT) { - return BooleanScriptFieldScriptTests.DUMMY; + if (context == BooleanFieldScript.CONTEXT) { + return BooleanFieldScriptTests.DUMMY; } - if (context == DateScriptFieldScript.CONTEXT) { - return DateScriptFieldScriptTests.DUMMY; + if (context == DateFieldScript.CONTEXT) { + return DateFieldScriptTests.DUMMY; } - if (context == DoubleScriptFieldScript.CONTEXT) { - return DoubleScriptFieldScriptTests.DUMMY; + if (context == DoubleFieldScript.CONTEXT) { + return DoubleFieldScriptTests.DUMMY; } - if (context == IpScriptFieldScript.CONTEXT) { - return IpScriptFieldScriptTests.DUMMY; + if (context == IpFieldScript.CONTEXT) { + return IpFieldScriptTests.DUMMY; } - if (context == LongScriptFieldScript.CONTEXT) { - return LongScriptFieldScriptTests.DUMMY; + if (context == LongFieldScript.CONTEXT) { + return LongFieldScriptTests.DUMMY; } - if (context == StringScriptFieldScript.CONTEXT) { - return StringScriptFieldScriptTests.DUMMY; + if (context == StringFieldScript.CONTEXT) { + return StringFieldScriptTests.DUMMY; } throw new IllegalArgumentException("Unsupported context: " + context); }; public Set> getSupportedContexts() { return org.elasticsearch.common.collect.Set.of( - BooleanScriptFieldScript.CONTEXT, - DateScriptFieldScript.CONTEXT, - DoubleScriptFieldScript.CONTEXT, - IpScriptFieldScript.CONTEXT, - StringScriptFieldScript.CONTEXT, - LongScriptFieldScript.CONTEXT + BooleanFieldScript.CONTEXT, + DateFieldScript.CONTEXT, + DoubleFieldScript.CONTEXT, + IpFieldScript.CONTEXT, + StringFieldScript.CONTEXT, + LongFieldScript.CONTEXT ); } }; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldTypeTests.java index 37928e97f19..6481e3fd439 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptBooleanMappedFieldTypeTests.java @@ -49,8 +49,6 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.runtimefields.BooleanScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; import org.elasticsearch.xpack.runtimefields.RuntimeFields; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptBooleanFieldData; @@ -468,7 +466,7 @@ public class ScriptBooleanMappedFieldTypeTests extends AbstractNonTextScriptMapp @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(DoubleScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(DoubleFieldScript.CONTEXT); } @Override @@ -483,15 +481,10 @@ public class ScriptBooleanMappedFieldTypeTests extends AbstractNonTextScriptMapp return factory; } - private BooleanScriptFieldScript.Factory factory(String code) { + private BooleanFieldScript.Factory factory(String code) { switch (code) { case "read_foo": - return (fieldName, params, lookup) -> (ctx) -> new BooleanScriptFieldScript( - fieldName, - params, - lookup, - ctx - ) { + return (fieldName, params, lookup) -> (ctx) -> new BooleanFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -500,12 +493,7 @@ public class ScriptBooleanMappedFieldTypeTests extends AbstractNonTextScriptMapp } }; case "xor_param": - return (fieldName, params, lookup) -> (ctx) -> new BooleanScriptFieldScript( - fieldName, - params, - lookup, - ctx - ) { + return (fieldName, params, lookup) -> (ctx) -> new BooleanFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -531,7 +519,7 @@ public class ScriptBooleanMappedFieldTypeTests extends AbstractNonTextScriptMapp org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - BooleanScriptFieldScript.Factory factory = scriptService.compile(script, BooleanScriptFieldScript.CONTEXT); + BooleanFieldScript.Factory factory = scriptService.compile(script, BooleanFieldScript.CONTEXT); return new ScriptBooleanMappedFieldType("test", script, factory, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldTypeTests.java index 8291f190a85..351a068cec5 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDateMappedFieldTypeTests.java @@ -44,7 +44,6 @@ import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.DateScriptFieldScript; import org.elasticsearch.xpack.runtimefields.RuntimeFields; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptDateFieldData; @@ -497,7 +496,7 @@ public class ScriptDateMappedFieldTypeTests extends AbstractNonTextScriptMappedF @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(DateScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(DateFieldScript.CONTEXT); } @Override @@ -512,10 +511,10 @@ public class ScriptDateMappedFieldTypeTests extends AbstractNonTextScriptMappedF return factory; } - private DateScriptFieldScript.Factory factory(String code) { + private DateFieldScript.Factory factory(String code) { switch (code) { case "read_timestamp": - return (fieldName, params, lookup, formatter) -> ctx -> new DateScriptFieldScript( + return (fieldName, params, lookup, formatter) -> ctx -> new DateFieldScript( fieldName, params, lookup, @@ -525,13 +524,13 @@ public class ScriptDateMappedFieldTypeTests extends AbstractNonTextScriptMappedF @Override public void execute() { for (Object timestamp : (List) getSource().get("timestamp")) { - DateScriptFieldScript.Parse parse = new DateScriptFieldScript.Parse(this); + DateFieldScript.Parse parse = new DateFieldScript.Parse(this); emit(parse.parse(timestamp)); } } }; case "add_days": - return (fieldName, params, lookup, formatter) -> ctx -> new DateScriptFieldScript( + return (fieldName, params, lookup, formatter) -> ctx -> new DateFieldScript( fieldName, params, lookup, @@ -566,7 +565,7 @@ public class ScriptDateMappedFieldTypeTests extends AbstractNonTextScriptMappedF org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - DateScriptFieldScript.Factory factory = scriptService.compile(script, DateScriptFieldScript.CONTEXT); + DateFieldScript.Factory factory = scriptService.compile(script, DateFieldScript.CONTEXT); return new ScriptDateMappedFieldType("test", script, factory, dateTimeFormatter, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldTypeTests.java index 1bc706475ac..2abf47db193 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptDoubleMappedFieldTypeTests.java @@ -38,7 +38,6 @@ import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; import org.elasticsearch.xpack.runtimefields.RuntimeFields; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptDoubleFieldData; @@ -276,7 +275,7 @@ public class ScriptDoubleMappedFieldTypeTests extends AbstractNonTextScriptMappe @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(DoubleScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(DoubleFieldScript.CONTEXT); } @Override @@ -291,10 +290,10 @@ public class ScriptDoubleMappedFieldTypeTests extends AbstractNonTextScriptMappe return factory; } - private DoubleScriptFieldScript.Factory factory(String code) { + private DoubleFieldScript.Factory factory(String code) { switch (code) { case "read_foo": - return (fieldName, params, lookup) -> (ctx) -> new DoubleScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new DoubleFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -303,7 +302,7 @@ public class ScriptDoubleMappedFieldTypeTests extends AbstractNonTextScriptMappe } }; case "add_param": - return (fieldName, params, lookup) -> (ctx) -> new DoubleScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new DoubleFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -329,7 +328,7 @@ public class ScriptDoubleMappedFieldTypeTests extends AbstractNonTextScriptMappe org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - DoubleScriptFieldScript.Factory factory = scriptService.compile(script, DoubleScriptFieldScript.CONTEXT); + DoubleFieldScript.Factory factory = scriptService.compile(script, DoubleFieldScript.CONTEXT); return new ScriptDoubleMappedFieldType("test", script, factory, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldTypeTests.java index 817ee032c24..8e800077820 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptIpMappedFieldTypeTests.java @@ -38,9 +38,7 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; import org.elasticsearch.xpack.runtimefields.RuntimeFields; -import org.elasticsearch.xpack.runtimefields.StringScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptBinaryFieldData; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptIpFieldData; @@ -320,7 +318,7 @@ public class ScriptIpMappedFieldTypeTests extends AbstractScriptMappedFieldTypeT @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(StringScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(StringFieldScript.CONTEXT); } @Override @@ -335,10 +333,10 @@ public class ScriptIpMappedFieldTypeTests extends AbstractScriptMappedFieldTypeT return factory; } - private IpScriptFieldScript.Factory factory(String code) { + private IpFieldScript.Factory factory(String code) { switch (code) { case "read_foo": - return (fieldName, params, lookup) -> (ctx) -> new IpScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new IpFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -347,7 +345,7 @@ public class ScriptIpMappedFieldTypeTests extends AbstractScriptMappedFieldTypeT } }; case "append_param": - return (fieldName, params, lookup) -> (ctx) -> new IpScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new IpFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -373,7 +371,7 @@ public class ScriptIpMappedFieldTypeTests extends AbstractScriptMappedFieldTypeT org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - IpScriptFieldScript.Factory factory = scriptService.compile(script, IpScriptFieldScript.CONTEXT); + IpFieldScript.Factory factory = scriptService.compile(script, IpFieldScript.CONTEXT); return new ScriptIpMappedFieldType("test", script, factory, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldTypeTests.java index 39852b2a793..864c3b0070a 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptKeywordMappedFieldTypeTests.java @@ -42,7 +42,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.StringScriptFieldScript; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptBinaryFieldData; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptStringFieldData; @@ -384,7 +383,7 @@ public class ScriptKeywordMappedFieldTypeTests extends AbstractScriptMappedField @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(StringScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(StringFieldScript.CONTEXT); } @Override @@ -399,10 +398,10 @@ public class ScriptKeywordMappedFieldTypeTests extends AbstractScriptMappedField return factory; } - private StringScriptFieldScript.Factory factory(String code) { + private StringFieldScript.Factory factory(String code) { switch (code) { case "read_foo": - return (fieldName, params, lookup) -> ctx -> new StringScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> ctx -> new StringFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -411,7 +410,7 @@ public class ScriptKeywordMappedFieldTypeTests extends AbstractScriptMappedField } }; case "append_param": - return (fieldName, params, lookup) -> ctx -> new StringScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> ctx -> new StringFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -437,7 +436,7 @@ public class ScriptKeywordMappedFieldTypeTests extends AbstractScriptMappedField org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - StringScriptFieldScript.Factory factory = scriptService.compile(script, StringScriptFieldScript.CONTEXT); + StringFieldScript.Factory factory = scriptService.compile(script, StringFieldScript.CONTEXT); return new ScriptKeywordMappedFieldType("test", script, factory, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldTypeTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldTypeTests.java index 5355a42ce3d..6ba52d38f1b 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldTypeTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/ScriptLongMappedFieldTypeTests.java @@ -39,7 +39,6 @@ import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.xpack.runtimefields.LongScriptFieldScript; import org.elasticsearch.xpack.runtimefields.RuntimeFields; import org.elasticsearch.xpack.runtimefields.fielddata.ScriptLongFieldData; @@ -303,7 +302,7 @@ public class ScriptLongMappedFieldTypeTests extends AbstractNonTextScriptMappedF @Override public Set> getSupportedContexts() { - return org.elasticsearch.common.collect.Set.of(LongScriptFieldScript.CONTEXT); + return org.elasticsearch.common.collect.Set.of(LongFieldScript.CONTEXT); } @Override @@ -318,10 +317,10 @@ public class ScriptLongMappedFieldTypeTests extends AbstractNonTextScriptMappedF return factory; } - private LongScriptFieldScript.Factory factory(String code) { + private LongFieldScript.Factory factory(String code) { switch (code) { case "read_foo": - return (fieldName, params, lookup) -> (ctx) -> new LongScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new LongFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -330,7 +329,7 @@ public class ScriptLongMappedFieldTypeTests extends AbstractNonTextScriptMappedF } }; case "add_param": - return (fieldName, params, lookup) -> (ctx) -> new LongScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new LongFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object foo : (List) getSource().get("foo")) { @@ -341,7 +340,7 @@ public class ScriptLongMappedFieldTypeTests extends AbstractNonTextScriptMappedF case "millis_ago": // Painless actually call System.currentTimeMillis. We could mock the time but this works fine too. long now = System.currentTimeMillis(); - return (fieldName, params, lookup) -> (ctx) -> new LongScriptFieldScript(fieldName, params, lookup, ctx) { + return (fieldName, params, lookup) -> (ctx) -> new LongFieldScript(fieldName, params, lookup, ctx) { @Override public void execute() { for (Object timestamp : (List) getSource().get("timestamp")) { @@ -367,7 +366,7 @@ public class ScriptLongMappedFieldTypeTests extends AbstractNonTextScriptMappedF org.elasticsearch.common.collect.List.of(scriptPlugin, new RuntimeFields()) ); try (ScriptService scriptService = new ScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts)) { - LongScriptFieldScript.Factory factory = scriptService.compile(script, LongScriptFieldScript.CONTEXT); + LongFieldScript.Factory factory = scriptService.compile(script, LongFieldScript.CONTEXT); return new ScriptLongMappedFieldType("test", script, factory, emptyMap()); } } diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScriptTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java similarity index 81% rename from x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScriptTests.java rename to x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java index 53476c3641a..e5d022006a2 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/StringScriptFieldScriptTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/mapper/StringFieldScriptTests.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.runtimefields; +package org.elasticsearch.xpack.runtimefields.mapper; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.DirectoryReader; @@ -20,8 +20,8 @@ import java.io.IOException; import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.mock; -public class StringScriptFieldScriptTests extends ScriptFieldScriptTestCase { - public static final StringScriptFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new StringScriptFieldScript( +public class StringFieldScriptTests extends FieldScriptTestCase { + public static final StringFieldScript.Factory DUMMY = (fieldName, params, lookup) -> ctx -> new StringFieldScript( fieldName, params, lookup, @@ -34,12 +34,12 @@ public class StringScriptFieldScriptTests extends ScriptFieldScriptTestCase context() { - return StringScriptFieldScript.CONTEXT; + protected ScriptContext context() { + return StringFieldScript.CONTEXT; } @Override - protected StringScriptFieldScript.Factory dummyScript() { + protected StringFieldScript.Factory dummyScript() { return DUMMY; } @@ -47,7 +47,7 @@ public class StringScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -55,7 +55,7 @@ public class StringScriptFieldScriptTests extends ScriptFieldScriptTestCase null, null), @@ -82,7 +82,7 @@ public class StringScriptFieldScriptTests extends ScriptFieldScriptTestCase extends AbstractScriptFieldQueryTestCase { - protected final BooleanScriptFieldScript.LeafFactory leafFactory = mock(BooleanScriptFieldScript.LeafFactory.class); + protected final BooleanFieldScript.LeafFactory leafFactory = mock(BooleanFieldScript.LeafFactory.class); @Override public final void testVisit() { diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java index ce050133187..7c89aaa85c2 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractDoubleScriptFieldQueryTestCase.java @@ -6,14 +6,14 @@ package org.elasticsearch.xpack.runtimefields.query; -import org.elasticsearch.xpack.runtimefields.DoubleScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DoubleFieldScript; import static org.mockito.Mockito.mock; public abstract class AbstractDoubleScriptFieldQueryTestCase extends AbstractScriptFieldQueryTestCase { - protected final DoubleScriptFieldScript.LeafFactory leafFactory = mock(DoubleScriptFieldScript.LeafFactory.class); + protected final DoubleFieldScript.LeafFactory leafFactory = mock(DoubleFieldScript.LeafFactory.class); @Override public final void testVisit() { diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java index d57b8820752..652be6e07a4 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractIpScriptFieldQueryTestCase.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.document.InetAddressPoint; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.xpack.runtimefields.IpScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.IpFieldScript; import java.net.InetAddress; @@ -16,7 +16,7 @@ import static org.mockito.Mockito.mock; public abstract class AbstractIpScriptFieldQueryTestCase extends AbstractScriptFieldQueryTestCase { - protected final IpScriptFieldScript.LeafFactory leafFactory = mock(IpScriptFieldScript.LeafFactory.class); + protected final IpFieldScript.LeafFactory leafFactory = mock(IpFieldScript.LeafFactory.class); @Override public final void testVisit() { diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java index 68721da78b3..55ee5fc84a0 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractLongScriptFieldQueryTestCase.java @@ -7,13 +7,13 @@ package org.elasticsearch.xpack.runtimefields.query; import org.apache.lucene.index.LeafReaderContext; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; import java.util.function.Function; public abstract class AbstractLongScriptFieldQueryTestCase extends AbstractScriptFieldQueryTestCase< T> { - protected final Function leafFactory = ctx -> null; + protected final Function leafFactory = ctx -> null; @Override public final void testVisit() { diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java index d1a88a166a6..03db7f47ee5 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/AbstractStringScriptFieldQueryTestCase.java @@ -10,7 +10,7 @@ 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.StringScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.StringFieldScript; import java.util.ArrayList; import java.util.List; @@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock; public abstract class AbstractStringScriptFieldQueryTestCase extends AbstractScriptFieldQueryTestCase { - protected final StringScriptFieldScript.LeafFactory leafFactory = mock(StringScriptFieldScript.LeafFactory.class); + protected final StringFieldScript.LeafFactory leafFactory = mock(StringFieldScript.LeafFactory.class); /** * {@link Query#visit Visit} a query, collecting {@link ByteRunAutomaton automata}, diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java index d2d3a2f427e..030d38911ed 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/DoubleScriptFieldTermsQueryTests.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.runtimefields.query; import com.carrotsearch.hppc.LongHashSet; import com.carrotsearch.hppc.LongSet; - import org.elasticsearch.script.Script; import java.util.Arrays; diff --git a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java index cd389f7f00b..db14fe46838 100644 --- a/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java +++ b/x-pack/plugin/runtime-fields/src/test/java/org/elasticsearch/xpack/runtimefields/query/LongScriptFieldDistanceFeatureQueryTests.java @@ -18,8 +18,8 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.script.Script; import org.elasticsearch.search.lookup.SearchLookup; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.runtimefields.AbstractLongScriptFieldScript; -import org.elasticsearch.xpack.runtimefields.DateScriptFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.AbstractLongFieldScript; +import org.elasticsearch.xpack.runtimefields.mapper.DateFieldScript; import java.io.IOException; import java.util.Collections; @@ -29,7 +29,7 @@ import java.util.function.Function; import static org.hamcrest.Matchers.equalTo; public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFieldQueryTestCase { - private final Function leafFactory = ctx -> null; + private final Function leafFactory = ctx -> null; @Override protected LongScriptFieldDistanceFeatureQuery createTestInstance() { @@ -90,7 +90,7 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel ); try (DirectoryReader reader = iw.getReader()) { IndexSearcher searcher = newSearcher(reader); - Function leafFactory = ctx -> new DateScriptFieldScript( + Function leafFactory = ctx -> new DateFieldScript( "test", Collections.emptyMap(), new SearchLookup(null, null, null),