Преглед изворни кода

Consider copy_to in synthetic source implementation for binary field (#107784)

Oleksandr Kolomiiets пре 1 година
родитељ
комит
6290f8de91

+ 5 - 0
server/src/main/java/org/elasticsearch/index/mapper/BinaryFieldMapper.java

@@ -202,6 +202,11 @@ public class BinaryFieldMapper extends FieldMapper {
 
     @Override
     public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
+        if (copyTo.copyToFields().isEmpty() != true) {
+            throw new IllegalArgumentException(
+                "field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
+            );
+        }
         if (hasDocValues == false) {
             throw new IllegalArgumentException(
                 "field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it doesn't have doc values"

+ 0 - 5
server/src/test/java/org/elasticsearch/index/mapper/BinaryFieldMapperTests.java

@@ -199,11 +199,6 @@ public class BinaryFieldMapperTests extends MapperTestCase {
         return false;
     }
 
-    @Override
-    protected boolean supportsCopyTo() {
-        return false;
-    }
-
     @Override
     protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed) {
         return new SyntheticSourceSupport() {