|
75 | 75 | import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; |
76 | 76 | import org.elasticsearch.xcontent.ToXContent; |
77 | 77 | import org.elasticsearch.xcontent.XContentBuilder; |
78 | | -import org.elasticsearch.xcontent.XContentParser; |
79 | 78 |
|
80 | 79 | import java.io.IOException; |
81 | 80 | import java.util.ArrayList; |
@@ -1008,9 +1007,8 @@ public boolean canUseSyntheticSourceDelegateForQuerying() { |
1008 | 1007 | */ |
1009 | 1008 | public boolean canUseSyntheticSourceDelegateForSyntheticSource(final String value) { |
1010 | 1009 | if (syntheticSourceDelegate.isPresent()) { |
1011 | | - KeywordFieldMapper.KeywordFieldType kwdFieldType = syntheticSourceDelegate.get(); |
1012 | 1010 | // if the keyword field is going to be ignored, then we can't rely on it for synthetic source |
1013 | | - return kwdFieldType.isIgnored(value) == false; |
| 1011 | + return syntheticSourceDelegate.get().isIgnored(value) == false; |
1014 | 1012 | } |
1015 | 1013 | return false; |
1016 | 1014 | } |
@@ -1064,60 +1062,10 @@ protected String delegatingTo() { |
1064 | 1062 | return new BlockStoredFieldsReader.BytesFromStringsBlockLoader(name()); |
1065 | 1063 | } |
1066 | 1064 |
|
1067 | | - // _ignored_source field will contain entries for this field if it is not stored |
1068 | | - // and there is no syntheticSourceDelegate. |
1069 | | - // See #syntheticSourceSupport(). |
1070 | | - // But if a text field is a multi field it won't have an entry in _ignored_source. |
1071 | | - // The parent might, but we don't have enough context here to figure this out. |
1072 | | - // So we bail. |
1073 | | - if (isSyntheticSourceEnabled && syntheticSourceDelegate.isEmpty() && parentField == null) { |
1074 | | - return fallbackSyntheticSourceBlockLoader(blContext); |
1075 | | - } |
1076 | | - |
1077 | 1065 | SourceValueFetcher fetcher = SourceValueFetcher.toString(blContext.sourcePaths(name())); |
1078 | 1066 | return new BlockSourceReader.BytesRefsBlockLoader(fetcher, blockReaderDisiLookup(blContext)); |
1079 | 1067 | } |
1080 | 1068 |
|
1081 | | - FallbackSyntheticSourceBlockLoader fallbackSyntheticSourceBlockLoader(BlockLoaderContext blContext) { |
1082 | | - var reader = new FallbackSyntheticSourceBlockLoader.SingleValueReader<BytesRef>(null) { |
1083 | | - @Override |
1084 | | - public void convertValue(Object value, List<BytesRef> accumulator) { |
1085 | | - if (value != null) { |
1086 | | - accumulator.add(new BytesRef(value.toString())); |
1087 | | - } |
1088 | | - } |
1089 | | - |
1090 | | - @Override |
1091 | | - protected void parseNonNullValue(XContentParser parser, List<BytesRef> accumulator) throws IOException { |
1092 | | - var text = parser.textOrNull(); |
1093 | | - |
1094 | | - if (text != null) { |
1095 | | - accumulator.add(new BytesRef(text)); |
1096 | | - } |
1097 | | - } |
1098 | | - |
1099 | | - @Override |
1100 | | - public void writeToBlock(List<BytesRef> values, BlockLoader.Builder blockBuilder) { |
1101 | | - var bytesRefBuilder = (BlockLoader.BytesRefBuilder) blockBuilder; |
1102 | | - |
1103 | | - for (var value : values) { |
1104 | | - bytesRefBuilder.appendBytesRef(value); |
1105 | | - } |
1106 | | - } |
1107 | | - }; |
1108 | | - |
1109 | | - return new FallbackSyntheticSourceBlockLoader( |
1110 | | - reader, |
1111 | | - name(), |
1112 | | - IgnoredSourceFieldMapper.ignoredSourceFormat(blContext.indexSettings().getIndexVersionCreated()) |
1113 | | - ) { |
1114 | | - @Override |
1115 | | - public Builder builder(BlockFactory factory, int expectedCount) { |
1116 | | - return factory.bytesRefs(expectedCount); |
1117 | | - } |
1118 | | - }; |
1119 | | - } |
1120 | | - |
1121 | 1069 | /** |
1122 | 1070 | * Build an iterator of documents that have the field. This mirrors parseCreateField, |
1123 | 1071 | * using whatever |
|
0 commit comments