Remove some legacy code from when indices could have multiple types. (#35815)
This code is only necessary up to indices created with version 5.x while 7.0 only supports indices created with 6.x or 7.0.
This commit is contained in:
parent
2970abfce9
commit
5b370316a6
|
@ -445,13 +445,7 @@ final class DocumentParser {
|
|||
if (idField != null) {
|
||||
// We just need to store the id as indexed field, so that IndexWriter#deleteDocuments(term) can then
|
||||
// delete it when the root document is deleted too.
|
||||
if (idField.stringValue() != null) {
|
||||
// backward compat with 5.x
|
||||
// TODO: Remove on 7.0
|
||||
nestedDoc.add(new Field(IdFieldMapper.NAME, idField.stringValue(), IdFieldMapper.Defaults.NESTED_FIELD_TYPE));
|
||||
} else {
|
||||
nestedDoc.add(new Field(IdFieldMapper.NAME, idField.binaryValue(), IdFieldMapper.Defaults.NESTED_FIELD_TYPE));
|
||||
}
|
||||
nestedDoc.add(new Field(IdFieldMapper.NAME, idField.binaryValue(), IdFieldMapper.Defaults.NESTED_FIELD_TYPE));
|
||||
} else {
|
||||
throw new IllegalStateException("The root document of a nested document should have an _id field");
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.plain.DocValuesIndexFieldData;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -114,13 +113,8 @@ public class TypeFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
@Override
|
||||
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName) {
|
||||
if (hasDocValues()) {
|
||||
return new DocValuesIndexFieldData.Builder();
|
||||
} else {
|
||||
// means the index has a single type and the type field is implicit
|
||||
Function<MapperService, String> typeFunction = mapperService -> mapperService.documentMapper().type();
|
||||
return new ConstantIndexFieldData.Builder(typeFunction);
|
||||
}
|
||||
Function<MapperService, String> typeFunction = mapperService -> mapperService.documentMapper().type();
|
||||
return new ConstantIndexFieldData.Builder(typeFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue