-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Update the default for include_type_name to false. #37285
Update the default for include_type_name to false. #37285
Conversation
Pinging @elastic/es-search |
547d160
to
188cb0a
Compare
@@ -49,7 +49,7 @@ public String getName() { | |||
|
|||
@Override | |||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { | |||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); | |||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refer to a single constant here that controls our default policy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -86,7 +86,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC | |||
deprecationLogger.deprecated("Type exists requests are deprecated, as types have been deprecated."); | |||
} | |||
|
|||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); | |||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See earlier comment re single constant
@@ -68,11 +68,12 @@ public String getName() { | |||
|
|||
@Override | |||
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { | |||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); | |||
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See earlier comment re single constant
Further to earlier comments about adding a constant - I merged a PR for 6.x that adds such a constant. Could this PR perhaps add the same constant but with the new "false" setting ie:
Note that https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java#L257 should also need changing to refer to this new constant as well as the RestCreateIndexAction, RestGetMappingAction andRestPutMappingAction classes already in this PR |
Thanks @markharwood, I'll make sure to introduce the same constant as part of this PR. |
188cb0a
to
6cd858e
Compare
6cd858e
to
e20aebb
Compare
e20aebb
to
64093c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtibshirani I left a couple of questions, its probably not necessary to look at all the test adaptions in detail so I was mostly trying to see how the plan in the description fits the changes made and left some questions where I wasn't sure about the overall plan.
client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java
Show resolved
Hide resolved
@@ -177,28 +175,3 @@ PUT test?wait_for_active_shards=2 | |||
|
|||
A detailed explanation of `wait_for_active_shards` and its possible values can be found | |||
<<index-wait-for-active-shards,here>>. | |||
|
|||
[float] | |||
=== Skipping types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have the reverse section as well explaining how to keep types although deprecated in case you still need them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍good idea!
...framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java
Show resolved
Hide resolved
@@ -195,7 +195,8 @@ setup: | |||
indices.refresh: {} | |||
|
|||
- do: | |||
indices.get_mapping: {} | |||
indices.get_mapping: | |||
include_type_name: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary for mixed cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not technically necessary, since we don't use the output of the call. However, I just tried to use include_type_name = false
for all mixed-cluster set-ups for clarity/ consistency, as opposed to making individual calls on a test-by-test basis.
@@ -78,7 +78,7 @@ that can be set when creating an index, please check the | |||
[[mappings]] | |||
=== Mappings | |||
|
|||
The create index API allows to provide a type mapping: | |||
The create index API allows to provide a mapping: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON property is still called "mappings", plural so I'd be tempted to describe them as "field mappings".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Digging into the build failure I see |
Other build failure here is |
Thanks @cbuescher and @markharwood for the review and for digging into the build failures. For the |
727f626
to
2e54beb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, looks good from my side.
@elastic/es-clients I forgot to ping the clients team, my apologies! I think it's important to be aware of this PR because of the modification in the test harness:
Feel free to ping me if you have any questions about the REST tests changes. |
* master: (28 commits) Introduce retention lease serialization (elastic#37447) Update Delete Watch to allow unknown fields (elastic#37435) Make finalize step of recovery source non-blocking (elastic#37388) Update the default for include_type_name to false. (elastic#37285) Security: remove SSL settings fallback (elastic#36846) Adding mapping for hostname field (elastic#37288) Relax assertSameDocIdsOnShards assertion Reduce recovery time with compress or secure transport (elastic#36981) Implement ccr file restore (elastic#37130) Fix Eclipse specific compilation issue (elastic#37419) Performance fix. Reduce deprecation calls for the same bulk request (elastic#37415) [ML] Use String rep of Version in map for serialisation (elastic#37416) Cleanup Deadcode in Rest Tests (elastic#37418) Mute IndexShardRetentionLeaseTests.testCommit elastic#37420 unmuted test Remove unused index store in directory service Improve CloseWhileRelocatingShardsIT (elastic#37348) Fix ClusterBlock serialization and Close Index API logic after backport to 6.x (elastic#37360) Update the scroll example in the docs (elastic#37394) Update analysis.asciidoc (elastic#37404) ...
Follow-up to elastic#28497 Since elastic/elasticsearch#37285 has been merged, it's aparent there are a couple more places we need to specify include_type_name as a stop-gap until elastic#23650 is completed Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* [migrations] Fetch additional mappings with types Follow-up to #28497 Since elastic/elasticsearch#37285 has been merged, it's aparent there are a couple more places we need to specify include_type_name as a stop-gap until #23650 is completed Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co> * Updates tests Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@jtibshirani, thanks for the ping! I've tried to do what you suggest — adding |
The "include_type_name" parameter was temporarily introduced in elastic#37285 to facilitate moving the default parameter setting to "false" in many places in the documentation code snippets. Most of the places can simply be reverted without causing errors. In this change I looked for asciidoc files that contained the "include_type_name=true" addition when creating new indices but didn't look likey they made use of the "_doc" type for mappings. This is mostly the case e.g. in the analysis docs where index creating often only contains settings. I manually corrected the use of types in some places where the docs still used an explicit type name and not the dummy "_doc" type.
The "include_type_name" parameter was temporarily introduced in #37285 to facilitate moving the default parameter setting to "false" in many places in the documentation code snippets. Most of the places can simply be reverted without causing errors. In this change I looked for asciidoc files that contained the "include_type_name=true" addition when creating new indices but didn't look likey they made use of the "_doc" type for mappings. This is mostly the case e.g. in the analysis docs where index creating often only contains settings. I manually corrected the use of types in some places where the docs still used an explicit type name and not the dummy "_doc" type.
From #29453 and #37285, the `include_type_name` parameter was already present and defaulted to false. This PR makes the following updates: - Add deprecation warnings to `RestPutMappingAction`, plus tests in `RestPutMappingActionTests`. - Add a typeless 'put mappings' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I opted to create a new `PutMappingRequest` object that differs from the existing server one.
From #29453 and #37285, the include_type_name parameter was already present and defaulted to false. This PR makes the following updates: * Add deprecation warnings to RestCreateIndexAction, plus tests in RestCreateIndexActionTests. * Add a typeless 'create index' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I created new CreateIndexRequest and CreateIndexResponse objects that differ from the existing server ones.
From #29453 and #37285, the include_type_name parameter was already present and defaulted to false. This PR makes the following updates: * Add deprecation warnings to RestCreateIndexAction, plus tests in RestCreateIndexActionTests. * Add a typeless 'create index' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I created new CreateIndexRequest and CreateIndexResponse objects that differ from the existing server ones.
This PR removes the temporary change we made to the yml test harness in #37285 to automatically set `include_type_name` to `true` in index creation requests if it's not already specified. This is possible now that the vast majority of index creation requests were updated to be typeless in #37611. A few additional tests also needed updating here. Additionally, this PR updates the test harness to set `include_type_name` to `false` in index creation requests when communicating with 6.x nodes. This mirrors the logic added in #37611 to allow for typeless document write requests in test set-up code. With this update in place, we can remove many references to `include_type_name: false` from the yml tests.
This PR updates the default to
include_type_name
tofalse
for all APIs that accept it (indices.create, indices.put_mapping, indices.get_mapping, indices.get_field_mapping, indices.put_template, indices.get_template).It tries to fix up as many tests as possible so that they avoid using the
include_type_name
parameter altogether, and omit types from the mappings.The following approach was taken for the REST tests:
include_type_name
parameter altogether. This lets us test the default behavior._with_types.yml
), then useinclude_type_name = true
where appropriate, to continue to test the typed case.include_type_name = false
and omit types. This works in a mixed-cluster set-up because 6.7 nodes now understand this parameter as well.indices.create
requests. These are so common and scattered across so many tests that it would be too much for this PR to try to convert all of those tests to stop using types. The way we get around this is by a modification in the test harness: we check if theindices.create
call contains the parameterinclude_type_name
, and if not, set it totrue
when making the API call. Note that this is very much temporary and will need to be fixed in a series of follow-up PRs that update REST tests.The approach for REST documentation:
include_type_name
altogether and switch to the new API format.include_type_name=true
. Like the REST tests, it is a very large amount of manual work to dropinclude_type_name
everywhere, so I thought we would update the documentation in a series of follow-ups. I think it would be possible to take the same approach in the documentation that we do for other REST tests (don't add any parameter, but rely on settinginclude_type_name=true
in the test harness). However, I thought that it was best to avoid non-working documentation examples.Note that no changes were made to the Java HLRC yet (or HLRC tests), and we do not yet emit deprecation warnings. Those last pieces of work are coming in follow-up PRs.