Skip to content

Conversation

@romseygeek
Copy link
Contributor

External API requests can no longer include types, so we have no need to pass this
information along in internal PutMappingClusterStateUpdateRequest objects, or on
PutMappingRequests used by the internal node client.

Relates to #41059

@romseygeek romseygeek added :Search Foundations/Mapping Index mappings, including merging and defining field types :Data Management/Indices APIs APIs to create and manage indices and templates >refactoring v8.0.0 labels Nov 1, 2019
@romseygeek romseygeek self-assigned this Nov 1, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@romseygeek
Copy link
Contributor Author

There are a number of changes here to just pass _doc to things like mapper parsers; these will be removed later on, but I'm trying to keep individual PRs as small as possible.

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romseygeek Thanks Alan! I left small comments, but overall LGTM

return this;
@Override
public String toString() {
return "put-mapping";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be something else added (e.g. source of the request)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the history, I'm not sure why I added this in the first place, as it didn't have a toString() previously. I'll remove it.

PutMappingRequest request = new PutMappingRequest(index);

String type = randomAlphaOfLength(5);
request.type(type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also make a type "_doc" on the line 135?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

final long previousVersion = clusterService.state().metaData().index("test").getMappingVersion();
final PutMappingRequest request = new PutMappingRequest();
request.indices("test");
request.type("type");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also other tests in this file to use type _doc (e.g. line 167) or the intent is to do this in following PRs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan on doing this in subsequent PRs - for example, line 167 will need to change when we remove type from MapperService.merge

indicesOptions = IndicesOptions.readIndicesOptions(in);
type = in.readOptionalString();
if (in.getVersion().before(Version.V_8_0_0)) {
in.readOptionalString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could check the type and throw an IllegalArgumentException here as we've been doing in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@romseygeek
Copy link
Contributor Author

@elasticmachine update branch

@romseygeek romseygeek merged commit c1c7fa5 into elastic:master Nov 14, 2019
@romseygeek romseygeek deleted the types-removal/put-mapping branch November 14, 2019 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Indices APIs APIs to create and manage indices and templates >refactoring :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants