From c925108bd5984068c2d0c523ae84e4a560e2c1f8 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 15:43:26 -0700 Subject: [PATCH] [Type removal] Remove _type from _bulk yaml test, scripts, unused constants (#3372) (#3391) * [Type removal] Remove redundant _type deprecation checks in bulk request Signed-off-by: Suraj Singh * [Type removal] bulk yaml tests validating deprecation on _type and removal from scripts Signed-off-by: Suraj Singh (cherry picked from commit 7a73fb561e1a91071cd985c751fa8b6d3c41fe16) Co-authored-by: Suraj Singh --- .../ingest/common/ForEachProcessorTests.java | 1 - .../rest-api-spec/test/bulk/60_deprecated.yml | 20 ------------------- .../search/fields/SearchFieldsIT.java | 1 - .../termvectors/MultiTermVectorsResponse.java | 1 - .../action/update/UpdateHelper.java | 1 - 5 files changed, 24 deletions(-) delete mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/bulk/60_deprecated.yml diff --git a/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorTests.java b/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorTests.java index 8db3cefc3a6fd..f49d5492a09b3 100644 --- a/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorTests.java @@ -127,7 +127,6 @@ public void testMetadataAvailable() throws Exception { TestProcessor innerProcessor = new TestProcessor(id -> { id.setFieldValue("_ingest._value.index", id.getSourceAndMetadata().get("_index")); - id.setFieldValue("_ingest._value.type", id.getSourceAndMetadata().get("_type")); id.setFieldValue("_ingest._value.id", id.getSourceAndMetadata().get("_id")); }); ForEachProcessor processor = new ForEachProcessor("_tag", null, "values", innerProcessor, false); diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/bulk/60_deprecated.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/bulk/60_deprecated.yml deleted file mode 100644 index 8c8a840eb3f47..0000000000000 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/bulk/60_deprecated.yml +++ /dev/null @@ -1,20 +0,0 @@ - ---- -"Deprecated parameters should fail in Bulk query": - - do: - catch: bad_request - bulk: - body: | - { "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_version": 1 } } - { "doc": { "f1": "v1" } } - { "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2", "_version": 1 } } - { "doc": { "f1": "v2" } } - - - do: - catch: bad_request - bulk: - body: | - { "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_routing": "test1" } } - { "doc": { "f1": "v1" } } - { "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2", "_routing": "test1" } } - { "doc": { "f1": "v2" } } diff --git a/server/src/internalClusterTest/java/org/opensearch/search/fields/SearchFieldsIT.java b/server/src/internalClusterTest/java/org/opensearch/search/fields/SearchFieldsIT.java index 941f4982af9cc..e1cf5fe8dca93 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/fields/SearchFieldsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/fields/SearchFieldsIT.java @@ -142,7 +142,6 @@ protected Map, Object>> pluginScripts() { scripts.put("_fields['num1'].value", vars -> fieldsScript(vars, "num1")); scripts.put("_fields._uid.value", vars -> fieldsScript(vars, "_uid")); scripts.put("_fields._id.value", vars -> fieldsScript(vars, "_id")); - scripts.put("_fields._type.value", vars -> fieldsScript(vars, "_type")); scripts.put("_source.obj1", vars -> sourceScript(vars, "obj1")); scripts.put("_source.obj1.test", vars -> sourceScript(vars, "obj1.test")); diff --git a/server/src/main/java/org/opensearch/action/termvectors/MultiTermVectorsResponse.java b/server/src/main/java/org/opensearch/action/termvectors/MultiTermVectorsResponse.java index 1a9ec0b63f46c..6f72413b935b7 100644 --- a/server/src/main/java/org/opensearch/action/termvectors/MultiTermVectorsResponse.java +++ b/server/src/main/java/org/opensearch/action/termvectors/MultiTermVectorsResponse.java @@ -161,7 +161,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws static final class Fields { static final String DOCS = "docs"; static final String _INDEX = "_index"; - static final String _TYPE = "_type"; static final String _ID = "_id"; } diff --git a/server/src/main/java/org/opensearch/action/update/UpdateHelper.java b/server/src/main/java/org/opensearch/action/update/UpdateHelper.java index 09a0a6281b8fc..685b21b892fb3 100644 --- a/server/src/main/java/org/opensearch/action/update/UpdateHelper.java +++ b/server/src/main/java/org/opensearch/action/update/UpdateHelper.java @@ -482,7 +482,6 @@ public static class ContextFields { public static final String SOURCE = "_source"; public static final String NOW = "_now"; public static final String INDEX = "_index"; - public static final String TYPE = "_type"; public static final String ID = "_id"; public static final String VERSION = "_version"; public static final String ROUTING = "_routing";