Skip to content

Remove TypeFieldMapper #62838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions docs/reference/mapping/fields.asciidoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[[mapping-fields]]
== Metadata fields

Each document has metadata associated with it, such as the `_index`, mapping
<<mapping-type-field,`_type`>>, and `_id` metadata fields. The behavior of
some of these metadata fields can be customized when a mapping type is created.
Each document has metadata associated with it, such as the `_index`
and `_id` metadata fields. The behavior of some of these metadata
fields can be customized when a mapping is created.

[discrete]
=== Identity metadata fields
Expand All @@ -13,10 +13,6 @@ some of these metadata fields can be customized when a mapping type is created.

The index to which the document belongs.

<<mapping-type-field,`_type`>>::

The document's mapping type.

<<mapping-id-field,`_id`>>::

The document's ID.
Expand Down Expand Up @@ -74,5 +70,3 @@ include::fields/routing-field.asciidoc[]

include::fields/source-field.asciidoc[]

include::fields/type-field.asciidoc[]

65 changes: 0 additions & 65 deletions docs/reference/mapping/fields/type-field.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
setup:
- skip:
features: ["headers"]
features: ["headers", "allowed_warnings"]

- do:
indices.create:
Expand Down Expand Up @@ -567,6 +567,8 @@ setup:
"Test exists query on _type field":

- do:
allowed_warnings:
- "[types removal] Using the _type field in queries and aggregations is deprecated, prefer to use a field instead."
search:
rest_total_hits_as_int: true
index: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public DocumentMapper(MapperService mapperService, Mapping mapping) {
}

final Collection<String> deleteTombstoneMetadataFields = Arrays.asList(VersionFieldMapper.NAME, IdFieldMapper.NAME,
TypeFieldMapper.NAME, SeqNoFieldMapper.NAME, SeqNoFieldMapper.PRIMARY_TERM_NAME, SeqNoFieldMapper.TOMBSTONE_NAME);
SeqNoFieldMapper.NAME, SeqNoFieldMapper.PRIMARY_TERM_NAME, SeqNoFieldMapper.TOMBSTONE_NAME);
this.deleteTombstoneMetadataFieldMappers = Stream.of(mapping.metadataMappers)
.filter(field -> deleteTombstoneMetadataFields.contains(field.name())).toArray(MetadataFieldMapper[]::new);
final Collection<String> noopTombstoneMetadataFields = Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ public static Term extractTerm(Query termQuery) {
while (termQuery instanceof BoostQuery) {
termQuery = ((BoostQuery) termQuery).getQuery();
}
if (termQuery instanceof TypeFieldMapper.TypesQuery) {
assert ((TypeFieldMapper.TypesQuery) termQuery).getTerms().length == 1;
return new Term(TypeFieldMapper.NAME, ((TypeFieldMapper.TypesQuery) termQuery).getTerms()[0]);
}
if (termQuery instanceof TermInSetQuery) {
TermInSetQuery tisQuery = (TermInSetQuery) termQuery;
PrefixCodedTerms terms = tisQuery.getTermData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ public DocumentMapperForType documentMapperWithAutoCreate() {
* Given the full name of a field, returns its {@link MappedFieldType}.
*/
public MappedFieldType fieldType(String fullName) {
if (fullName.equals(TypeFieldType.NAME)) {
return new TypeFieldType(this.mapper == null ? "_doc" : this.mapper.type());
}
return this.mapper == null ? null : this.mapper.fieldTypes().get(fullName);
}

Expand Down

This file was deleted.

Loading