Skip to content
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

Deprecate types in index API #36575

Merged
merged 7 commits into from Dec 18, 2018

Conversation

Projects
None yet
5 participants
@mayya-sharipova
Copy link
Contributor

commented Dec 12, 2018

  • deprecate type-based constructors of IndexRequest
  • update tests to use typeless IndexRequest constructors
  • no yaml tests as they have been already added in #35790

Relates to #35190

@elasticmachine

This comment has been minimized.

Copy link

commented Dec 12, 2018

@mayya-sharipova mayya-sharipova added the WIP label Dec 13, 2018

@mayya-sharipova mayya-sharipova force-pushed the mayya-sharipova:deprecate_types_index branch 3 times, most recently from 06a9045 to 5de4d1b Dec 13, 2018

@mayya-sharipova mayya-sharipova removed the WIP label Dec 14, 2018

Deprecate types in index API
- deprecate type-based constructors of IndexRequest
- update tests to use typeless IndexRequest constructors
- no yaml tests as they have been already added in #35790

Relates to #35190

@mayya-sharipova mayya-sharipova force-pushed the mayya-sharipova:deprecate_types_index branch from 5de4d1b to 560315b Dec 16, 2018

@markharwood
Copy link
Contributor

left a comment

Added a few minor comments but otherwise LGTM

LogManager.getLogger(RestDeleteAction.class));
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in " +
"document index requests is deprecated, use the /{index}/_doc/{id} endpoint instead.";

This comment has been minimized.

Copy link
@markharwood

markharwood Dec 17, 2018

Contributor

This message may be misleading if the user didn't supply an ID.

throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the index APIs with the " +
"[{index}/_doc/{id}] and [{index}/_doc] endpoints.");
if (!type.equals(MapperService.SINGLE_MAPPING_NAME)) {
deprecationLogger.deprecatedAndMaybeLog("index_with_types", TYPES_DEPRECATION_MESSAGE);

This comment has been minimized.

Copy link
@markharwood

markharwood Dec 17, 2018

Contributor

For readability we prefer X==false rather than !X

@@ -82,7 +82,7 @@ public void testRequests() throws Exception {
RestHighLevelClient client = highLevelClient();
{
//tag::migration-request-ctor
IndexRequest request = new IndexRequest("index", "_doc", "id"); // <1>
IndexRequest request = new IndexRequest("index").id("id"); // <1>
request.source("{\"field\":\"value\"}", XContentType.JSON);

This comment has been minimized.

Copy link
@markharwood

markharwood Dec 17, 2018

Contributor

Related doc says Create an IndexRequest using its constructor -perhaps add comment on the use of id() setter too.

@jtibshirani
Copy link
Member

left a comment

Looks good to me too, just a few small questions!

@@ -135,7 +135,7 @@ public void testSearchSkipUnavailable() throws IOException {

for (int i = 0; i < 10; i++) {
restHighLevelClient.index(
new IndexRequest("index", "doc", String.valueOf(i)).source("field", "value"), RequestOptions.DEFAULT);
new IndexRequest("index", "_doc", String.valueOf(i)).source("field", "value"), RequestOptions.DEFAULT);

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

For my knowledge, why didn't we remove the type altogether, as in new IndexRequest("index").id(...))?

@@ -59,6 +60,7 @@ protected SecurityConfig securityConfig() {
protected void index(String index, CheckedConsumer<XContentBuilder, IOException> body) throws IOException {
Request request = new Request("PUT", "/" + index + "/doc/1");

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

I'm wondering if we could we switch this to _doc instead of expecting a warning?

This comment has been minimized.

Copy link
@mayya-sharipova

mayya-sharipova Dec 17, 2018

Author Contributor

@jtibshirani Thanks Julie. Changing this into a _doc in this file or in JdbcIntegrationTestCase.java now will lead to failures of many sql tests. I am planning to have a subsequent PR that can go through our xpack products and change them to use non-deprecated versions.

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

Making these changes in a follow-up PR works for me. I'll add a note to the meta issue to track this. It could be that the individual teams should make these changes, as I think it may require more than just updating integration tests. For example, the security indices are still created using the old type name doc.

@@ -84,6 +85,7 @@ public static void index(String index, CheckedConsumer<XContentBuilder, IOExcept

public static void index(String index, String documentId, CheckedConsumer<XContentBuilder, IOException> body) throws IOException {
Request request = new Request("PUT", "/" + index + "/doc/" + documentId);
request.setOptions(expectWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE));

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

Same question here around switching to _doc.

}

@SuppressWarnings("unchecked")
public void testTypeGlobalAndPerRequest() throws IOException {

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

It might be nice to leave this in (with expectWarnings calls), as I don't see this functionality being tested elsewhere.

This comment has been minimized.

Copy link
@mayya-sharipova

mayya-sharipova Dec 17, 2018

Author Contributor

@jtibshirani Thanks for the suggestion, Julie. But this test will not work anymore, as creating an IndexRequest without a type like new IndexRequest("index2").id("2") will assign a type of _doc to it. While the test here checks that that that the result type should be "global_type".

This comment has been minimized.

Copy link
@mayya-sharipova

mayya-sharipova Dec 17, 2018

Author Contributor

I am going to temporary disable this test with AwaitsFix, and let @markharwood address this test through his bulk API change.

This comment has been minimized.

Copy link
@jtibshirani

jtibshirani Dec 17, 2018

Member

Oh, I didn't realize this was actually broken. I now see it is also broken for update and delete. I would also be okay adding AwaitsFix, and we can work to fix the issue as soon as possible in another PR.

@jtibshirani jtibshirani referenced this pull request Dec 17, 2018

Closed

Implementation tracking for 7.0 types deprecation. #35190

48 of 48 tasks complete
@mayya-sharipova

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2018

@elasticmachine run the gradle build tests 1

@mayya-sharipova

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2018

@elasticmachine run the default distro tests

@mayya-sharipova mayya-sharipova merged commit f884b2b into elastic:master Dec 18, 2018

8 checks passed

CLA Commit author is a member of Elasticsearch
Details
elasticsearch-ci-1 Build finished.
Details
elasticsearch-ci-2 Build finished.
Details
elasticsearch-ci/default-distro Build finished.
Details
elasticsearch-ci/docbldesx Build finished.
Details
elasticsearch-ci/docs-check Build finished.
Details
elasticsearch-ci/oss-distro-docs Build finished.
Details
elasticsearch-ci/packaging-sample Build finished.
Details

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Dec 18, 2018

Merge remote-tracking branch 'elastic/master' into lazier-ingest-geoip
* elastic/master: (31 commits)
  enable bwc tests and switch transport serialization version to 6.6.0 for CAS features
  [DOCs] Adds ml-cpp PRs to alpha release notes (elastic#36790)
  Synchronize WriteReplicaResult callbacks (elastic#36770)
  Add CcrRestoreSourceService to track sessions (elastic#36578)
  [Painless] Add tests for boxed return types (elastic#36747)
  Internal: Remove originalSettings from Node (elastic#36569)
  [ILM][DOCS] Update ILM API authorization docs (elastic#36749)
  Core: Deprecate use of scientific notation in epoch time parsing (elastic#36691)
  [ML] Merge the Jindex master feature branch (elastic#36702)
  Tests: Mute SnapshotDisruptionIT.testDisruptionOnSnapshotInitialization
  Update versions in SearchSortValues transport serialization
  Update version in SearchHits transport serialization
  [Geo] Integrate Lucene's LatLonShape (BKD Backed GeoShapes) as default `geo_shape` indexing approach (elastic#36751)
  [Docs] Fix error in Common Grams Token Filter (elastic#36774)
  Fix rollup search statistics (elastic#36674)
  SQL: Fix wrong appliance of StackOverflow limit for IN (elastic#36724)
  [TEST] Added more logging
  Invalidate Token API enhancements - HLRC (elastic#36362)
  Deprecate types in index API (elastic#36575)
  Disable bwc tests until elastic#36555 backport is complete (elastic#36737)
  ...

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Dec 18, 2018

Merge remote-tracking branch 'elastic/master' into ingest-geoip-module
* elastic/master: (61 commits)
  enable bwc tests and switch transport serialization version to 6.6.0 for CAS features
  [DOCs] Adds ml-cpp PRs to alpha release notes (elastic#36790)
  Synchronize WriteReplicaResult callbacks (elastic#36770)
  Add CcrRestoreSourceService to track sessions (elastic#36578)
  [Painless] Add tests for boxed return types (elastic#36747)
  Internal: Remove originalSettings from Node (elastic#36569)
  [ILM][DOCS] Update ILM API authorization docs (elastic#36749)
  Core: Deprecate use of scientific notation in epoch time parsing (elastic#36691)
  [ML] Merge the Jindex master feature branch (elastic#36702)
  Tests: Mute SnapshotDisruptionIT.testDisruptionOnSnapshotInitialization
  Update versions in SearchSortValues transport serialization
  Update version in SearchHits transport serialization
  [Geo] Integrate Lucene's LatLonShape (BKD Backed GeoShapes) as default `geo_shape` indexing approach (elastic#36751)
  [Docs] Fix error in Common Grams Token Filter (elastic#36774)
  Fix rollup search statistics (elastic#36674)
  SQL: Fix wrong appliance of StackOverflow limit for IN (elastic#36724)
  [TEST] Added more logging
  Invalidate Token API enhancements - HLRC (elastic#36362)
  Deprecate types in index API (elastic#36575)
  Disable bwc tests until elastic#36555 backport is complete (elastic#36737)
  ...

@colings86 colings86 added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.