diff --git a/modules/mapper-extras/src/test/java/org/opensearch/index/query/RankFeatureQueryBuilderTests.java b/modules/mapper-extras/src/test/java/org/opensearch/index/query/RankFeatureQueryBuilderTests.java index b0d7bb9d2e14e..e183ba6f6735c 100644 --- a/modules/mapper-extras/src/test/java/org/opensearch/index/query/RankFeatureQueryBuilderTests.java +++ b/modules/mapper-extras/src/test/java/org/opensearch/index/query/RankFeatureQueryBuilderTests.java @@ -62,7 +62,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws "_doc", new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef( + PutMappingRequest.simpleMapping( "my_feature_field", "type=rank_feature", "my_negative_feature_field", diff --git a/modules/percolator/src/internalClusterTest/java/org/opensearch/percolator/PercolatorQuerySearchIT.java b/modules/percolator/src/internalClusterTest/java/org/opensearch/percolator/PercolatorQuerySearchIT.java index 1cb5d81136de1..11fc61d6c6d99 100644 --- a/modules/percolator/src/internalClusterTest/java/org/opensearch/percolator/PercolatorQuerySearchIT.java +++ b/modules/percolator/src/internalClusterTest/java/org/opensearch/percolator/PercolatorQuerySearchIT.java @@ -565,7 +565,7 @@ public void testPercolatorQueryWithHighlighting() throws Exception { client().admin() .indices() .prepareCreate("test") - .addMapping("type", "id", "type=keyword", "field1", fieldMapping, "query", "type=percolator") + .addMapping("type", "id", "type=keyword", "field1", fieldMapping.toString(), "query", "type=percolator") ); client().prepareIndex("test") .setId("1") diff --git a/modules/percolator/src/test/java/org/opensearch/percolator/PercolateQueryBuilderTests.java b/modules/percolator/src/test/java/org/opensearch/percolator/PercolateQueryBuilderTests.java index 12be15552652c..44d8d64086091 100644 --- a/modules/percolator/src/test/java/org/opensearch/percolator/PercolateQueryBuilderTests.java +++ b/modules/percolator/src/test/java/org/opensearch/percolator/PercolateQueryBuilderTests.java @@ -110,14 +110,14 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws docType, new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef(queryField, "type=percolator", aliasField, "type=alias,path=" + queryField) + PutMappingRequest.simpleMapping(queryField, "type=percolator", aliasField, "type=alias,path=" + queryField) ) ), MapperService.MergeReason.MAPPING_UPDATE ); mapperService.merge( docType, - new CompressedXContent(Strings.toString(PutMappingRequest.buildFromSimplifiedDef(TEXT_FIELD_NAME, "type=text"))), + new CompressedXContent(Strings.toString(PutMappingRequest.simpleMapping(TEXT_FIELD_NAME, "type=text"))), MapperService.MergeReason.MAPPING_UPDATE ); } diff --git a/modules/percolator/src/test/java/org/opensearch/percolator/PercolateWithNestedQueryBuilderTests.java b/modules/percolator/src/test/java/org/opensearch/percolator/PercolateWithNestedQueryBuilderTests.java index 5038e72e9be5e..0ab9eff731bff 100644 --- a/modules/percolator/src/test/java/org/opensearch/percolator/PercolateWithNestedQueryBuilderTests.java +++ b/modules/percolator/src/test/java/org/opensearch/percolator/PercolateWithNestedQueryBuilderTests.java @@ -50,7 +50,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws super.initializeAdditionalMappings(mapperService); mapperService.merge( "_doc", - new CompressedXContent(Strings.toString(PutMappingRequest.buildFromSimplifiedDef("some_nested_object", "type=nested"))), + new CompressedXContent(Strings.toString(PutMappingRequest.simpleMapping("some_nested_object", "type=nested"))), MapperService.MergeReason.MAPPING_UPDATE ); } diff --git a/server/src/internalClusterTest/java/org/opensearch/document/AliasedIndexDocumentActionsIT.java b/server/src/internalClusterTest/java/org/opensearch/document/AliasedIndexDocumentActionsIT.java index de9db5f145116..1d9f7c1e39de2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/document/AliasedIndexDocumentActionsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/document/AliasedIndexDocumentActionsIT.java @@ -49,7 +49,7 @@ protected void createIndex() { logger.info("--> creating index test"); client().admin() .indices() - .create(createIndexRequest("test1").mapping("type1", "name", "type=keyword,store=true").alias(new Alias("test"))) + .create(createIndexRequest("test1").simpleMapping("name", "type=keyword,store=true").alias(new Alias("test"))) .actionGet(); } diff --git a/server/src/internalClusterTest/java/org/opensearch/index/HiddenIndexIT.java b/server/src/internalClusterTest/java/org/opensearch/index/HiddenIndexIT.java index 54fbc8cecb967..7d1c92cba3205 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/HiddenIndexIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/HiddenIndexIT.java @@ -122,7 +122,7 @@ public void testGlobalTemplatesDoNotApply() { .indices() .preparePutTemplate("a_global_template") .setPatterns(Collections.singletonList("*")) - .addMapping("_doc", "foo", "type=text") + .setMapping("foo", "type=text") .get() ); assertAcked( @@ -130,7 +130,7 @@ public void testGlobalTemplatesDoNotApply() { .indices() .preparePutTemplate("not_global_template") .setPatterns(Collections.singletonList("a*")) - .addMapping("_doc", "bar", "type=text") + .setMapping("bar", "type=text") .get() ); assertAcked( @@ -138,7 +138,7 @@ public void testGlobalTemplatesDoNotApply() { .indices() .preparePutTemplate("specific_template") .setPatterns(Collections.singletonList("a_hidden_index")) - .addMapping("_doc", "baz", "type=text") + .setMapping("baz", "type=text") .get() ); assertAcked( @@ -146,7 +146,7 @@ public void testGlobalTemplatesDoNotApply() { .indices() .preparePutTemplate("unused_template") .setPatterns(Collections.singletonList("not_used")) - .addMapping("_doc", "foobar", "type=text") + .setMapping("foobar", "type=text") .get() ); @@ -192,7 +192,7 @@ public void testNonGlobalTemplateCanMakeIndexHidden() { .indices() .preparePutTemplate("a_global_template") .setPatterns(Collections.singletonList("my_hidden_pattern*")) - .addMapping("_doc", "foo", "type=text") + .setMapping("foo", "type=text") .setSettings(Settings.builder().put("index.hidden", true).build()) .get() ); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/template/SimpleIndexTemplateIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/template/SimpleIndexTemplateIT.java index 378657a6554b4..6065db46d8ee2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/template/SimpleIndexTemplateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/template/SimpleIndexTemplateIT.java @@ -554,7 +554,7 @@ public void testIndexTemplateWithAliases() throws Exception { .indices() .preparePutTemplate("template_with_aliases") .setPatterns(Collections.singletonList("te*")) - .addMapping("_doc", "type", "type=keyword", "field", "type=text") + .setMapping("type", "type=keyword", "field", "type=text") .addAlias(new Alias("simple_alias")) .addAlias(new Alias("templated_alias-{index}")) .addAlias(new Alias("filtered_alias").filter("{\"term\":{\"type\":\"type2\"}}")) @@ -820,7 +820,7 @@ public void testStrictAliasParsingInIndicesCreatedViaTemplates() throws Exceptio .preparePutTemplate("template1") .setPatterns(Collections.singletonList("a*")) .setOrder(0) - .addMapping("test", "field", "type=text") + .setMapping("field", "type=text") .addAlias(new Alias("alias1").filter(termQuery("field", "value"))) .get(); // Indexing into b index should fail, since there is field with name 'field' in the mapping @@ -930,7 +930,7 @@ public void testOrderAndVersion() { .setPatterns(Collections.singletonList("te*")) .setVersion(version) .setOrder(order) - .addMapping("test", "field", "type=text") + .setMapping("field", "type=text") .get() ); diff --git a/server/src/internalClusterTest/java/org/opensearch/search/basic/TransportTwoNodesSearchIT.java b/server/src/internalClusterTest/java/org/opensearch/search/basic/TransportTwoNodesSearchIT.java index 420121006a943..5cd6e76e1e487 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/basic/TransportTwoNodesSearchIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/basic/TransportTwoNodesSearchIT.java @@ -96,7 +96,7 @@ private Set prepareData(int numShards) throws Exception { client().admin() .indices() - .create(createIndexRequest("test").settings(settingsBuilder).mapping("type", "foo", "type=geo_point")) + .create(createIndexRequest("test").settings(settingsBuilder).simpleMapping("foo", "type=geo_point")) .actionGet(); ensureGreen(); diff --git a/server/src/internalClusterTest/java/org/opensearch/search/searchafter/SearchAfterIT.java b/server/src/internalClusterTest/java/org/opensearch/search/searchafter/SearchAfterIT.java index b88e56b4f675d..aae6c1dec48b3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/searchafter/SearchAfterIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/searchafter/SearchAfterIT.java @@ -323,7 +323,7 @@ private void createIndexMappingsFromObjectType(String indexName, String typeName fail("Can't match type [" + type + "]"); } } - indexRequestBuilder.addMapping(typeName, mappings.toArray()).get(); + indexRequestBuilder.addMapping(typeName, mappings.toArray(new String[0])).get(); ensureGreen(); } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequest.java b/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequest.java index b234561563e56..7f1f516d13a04 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequest.java @@ -305,11 +305,9 @@ private CreateIndexRequest mapping(String type, Map source) { /** * A specialized simplified mapping source method, takes the form of simple properties definition: * ("field1", "type=string,store=true"). - * @deprecated types are being removed */ - @Deprecated - public CreateIndexRequest mapping(String type, Object... source) { - mapping(PutMappingRequest.buildFromSimplifiedDef(source)); + public CreateIndexRequest simpleMapping(String... source) { + mapping(PutMappingRequest.simpleMapping(source)); return this; } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequestBuilder.java b/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequestBuilder.java index 41f364517fd06..ac80b3eb6a155 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequestBuilder.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/create/CreateIndexRequestBuilder.java @@ -144,8 +144,8 @@ public CreateIndexRequestBuilder setMapping(Map source) { * @deprecated types are being removed */ @Deprecated - public CreateIndexRequestBuilder addMapping(String type, Object... source) { - request.mapping(type, source); + public CreateIndexRequestBuilder addMapping(String type, String... source) { + request.simpleMapping(source); return this; } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequest.java b/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequest.java index 52be45054ba55..be3e676a4a1a2 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -217,8 +217,8 @@ public String source() { * Also supports metadata mapping fields such as `_all` and `_parent` as property definition, these metadata * mapping fields will automatically be put on the top level mapping object. */ - public PutMappingRequest source(Object... source) { - return source(buildFromSimplifiedDef(source)); + public PutMappingRequest source(String... source) { + return source(simpleMapping(source)); } public String origin() { @@ -239,7 +239,7 @@ public PutMappingRequest origin(String origin) { * if the number of the source arguments is not divisible by two * @return the mappings definition */ - public static XContentBuilder buildFromSimplifiedDef(Object... source) { + public static XContentBuilder simpleMapping(String... source) { if (source.length % 2 != 0) { throw new IllegalArgumentException("mapping source must be pairs of fieldnames and properties definition."); } @@ -248,10 +248,10 @@ public static XContentBuilder buildFromSimplifiedDef(Object... source) { builder.startObject(); for (int i = 0; i < source.length; i++) { - String fieldName = source[i++].toString(); + String fieldName = source[i++]; if (RESERVED_FIELDS.contains(fieldName)) { builder.startObject(fieldName); - String[] s1 = Strings.splitStringByCommaToArray(source[i].toString()); + String[] s1 = Strings.splitStringByCommaToArray(source[i]); for (String s : s1) { String[] s2 = Strings.split(s, "="); if (s2.length != 2) { @@ -265,13 +265,13 @@ public static XContentBuilder buildFromSimplifiedDef(Object... source) { builder.startObject("properties"); for (int i = 0; i < source.length; i++) { - String fieldName = source[i++].toString(); + String fieldName = source[i++]; if (RESERVED_FIELDS.contains(fieldName)) { continue; } builder.startObject(fieldName); - String[] s1 = Strings.splitStringByCommaToArray(source[i].toString()); + String[] s1 = Strings.splitStringByCommaToArray(source[i]); for (String s : s1) { String[] s2 = Strings.split(s, "="); if (s2.length != 2) { diff --git a/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java b/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java index a1b3b40d4e961..3ef96254b3f9b 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java @@ -102,7 +102,7 @@ public PutMappingRequestBuilder setSource(String mappingSource, XContentType xCo * A specialized simplified mapping source method, takes the form of simple properties definition: * ("field1", "type=string,store=true"). */ - public PutMappingRequestBuilder setSource(Object... source) { + public PutMappingRequestBuilder setSource(String... source) { request.source(source); return this; } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/rollover/RolloverRequestBuilder.java b/server/src/main/java/org/opensearch/action/admin/indices/rollover/RolloverRequestBuilder.java index a7af2f963d15b..c74f71a70e09d 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/rollover/RolloverRequestBuilder.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/rollover/RolloverRequestBuilder.java @@ -84,8 +84,8 @@ public RolloverRequestBuilder alias(Alias alias) { return this; } - public RolloverRequestBuilder mapping(String type, Object... source) { - this.request.getCreateIndexRequest().mapping(type, source); + public RolloverRequestBuilder simpleMapping(String... source) { + this.request.getCreateIndexRequest().simpleMapping(source); return this; } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequest.java b/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequest.java index 2ea2e492ffe4d..d443d14f3f463 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequest.java @@ -58,6 +58,7 @@ import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.json.JsonXContent; import org.opensearch.common.xcontent.support.XContentMapValues; +import org.opensearch.index.mapper.MapperService; import java.io.IOException; import java.util.Collections; @@ -303,8 +304,8 @@ public PutIndexTemplateRequest mapping(String type, Map source) * A specialized simplified mapping source method, takes the form of simple properties definition: * ("field1", "type=string,store=true"). */ - public PutIndexTemplateRequest mapping(String type, Object... source) { - mapping(type, PutMappingRequest.buildFromSimplifiedDef(source)); + public PutIndexTemplateRequest mapping(String... source) { + mapping(MapperService.SINGLE_MAPPING_NAME, PutMappingRequest.simpleMapping(source)); return this; } diff --git a/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java b/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java index caff201abeda7..df3b5f6417576 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java @@ -137,8 +137,8 @@ public PutIndexTemplateRequestBuilder addMapping(String type, String source, XCo * A specialized simplified mapping source method, takes the form of simple properties definition: * ("field1", "type=string,store=true"). */ - public PutIndexTemplateRequestBuilder addMapping(String type, Object... source) { - request.mapping(type, source); + public PutIndexTemplateRequestBuilder setMapping(String... source) { + request.mapping(source); return this; } diff --git a/server/src/test/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestTests.java b/server/src/test/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestTests.java index ab401b7d45792..d8178769ba7b1 100644 --- a/server/src/test/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestTests.java +++ b/server/src/test/java/org/opensearch/action/admin/indices/mapping/put/PutMappingRequestTests.java @@ -92,15 +92,12 @@ public void testValidation() { } /** - * Test that {@link PutMappingRequest#buildFromSimplifiedDef(Object...)} + * Test that {@link PutMappingRequest#simpleMapping(String...)} * rejects inputs where the {@code Object...} varargs of field name and properties are not * paired correctly */ public void testBuildFromSimplifiedDef() { - IllegalArgumentException e = expectThrows( - IllegalArgumentException.class, - () -> PutMappingRequest.buildFromSimplifiedDef("only_field") - ); + IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PutMappingRequest.simpleMapping("only_field")); assertEquals("mapping source must be pairs of fieldnames and properties definition.", e.getMessage()); } diff --git a/server/src/test/java/org/opensearch/index/mapper/RangeFieldQueryStringQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/mapper/RangeFieldQueryStringQueryBuilderTests.java index 0a01d86e76dea..a8245627c6930 100644 --- a/server/src/test/java/org/opensearch/index/mapper/RangeFieldQueryStringQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/mapper/RangeFieldQueryStringQueryBuilderTests.java @@ -73,7 +73,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws "_doc", new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef( + PutMappingRequest.simpleMapping( INTEGER_RANGE_FIELD_NAME, "type=integer_range", LONG_RANGE_FIELD_NAME, diff --git a/server/src/test/java/org/opensearch/index/query/MatchQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/MatchQueryBuilderTests.java index dac32849e3cef..d6cd157d6f84e 100644 --- a/server/src/test/java/org/opensearch/index/query/MatchQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/MatchQueryBuilderTests.java @@ -390,7 +390,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws "_doc", new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef("string_boost", "type=text", "string_no_pos", "type=text,index_options=docs") + PutMappingRequest.simpleMapping("string_boost", "type=text", "string_no_pos", "type=text,index_options=docs") ) ), MapperService.MergeReason.MAPPING_UPDATE diff --git a/server/src/test/java/org/opensearch/index/query/NestedQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/NestedQueryBuilderTests.java index b95d9f8d36ad8..abc3e0bb8c4c3 100644 --- a/server/src/test/java/org/opensearch/index/query/NestedQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/NestedQueryBuilderTests.java @@ -77,7 +77,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws "_doc", new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef( + PutMappingRequest.simpleMapping( TEXT_FIELD_NAME, "type=text", INT_FIELD_NAME, diff --git a/server/src/test/java/org/opensearch/index/query/QueryStringQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/QueryStringQueryBuilderTests.java index b091fc2103344..393d4cb3f2121 100644 --- a/server/src/test/java/org/opensearch/index/query/QueryStringQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/QueryStringQueryBuilderTests.java @@ -1096,7 +1096,7 @@ public void testDisabledFieldNamesField() throws Exception { .merge( "_doc", new CompressedXContent( - Strings.toString(PutMappingRequest.buildFromSimplifiedDef("foo", "type=text", "_field_names", "enabled=false")) + Strings.toString(PutMappingRequest.simpleMapping("foo", "type=text", "_field_names", "enabled=false")) ), MapperService.MergeReason.MAPPING_UPDATE ); @@ -1112,7 +1112,7 @@ public void testDisabledFieldNamesField() throws Exception { .merge( "_doc", new CompressedXContent( - Strings.toString(PutMappingRequest.buildFromSimplifiedDef("foo", "type=text", "_field_names", "enabled=true")) + Strings.toString(PutMappingRequest.simpleMapping("foo", "type=text", "_field_names", "enabled=true")) ), MapperService.MergeReason.MAPPING_UPDATE ); diff --git a/server/src/test/java/org/opensearch/index/query/TermsSetQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/TermsSetQueryBuilderTests.java index 3c39773108830..43ca3139e30cb 100644 --- a/server/src/test/java/org/opensearch/index/query/TermsSetQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/TermsSetQueryBuilderTests.java @@ -93,7 +93,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws String docType = "_doc"; mapperService.merge( docType, - new CompressedXContent(Strings.toString(PutMappingRequest.buildFromSimplifiedDef("m_s_m", "type=long"))), + new CompressedXContent(Strings.toString(PutMappingRequest.simpleMapping("m_s_m", "type=long"))), MapperService.MergeReason.MAPPING_UPDATE ); } diff --git a/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java b/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java index e5d14333de828..ae32db5fe6032 100644 --- a/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java @@ -438,7 +438,7 @@ public void onRemoval(ShardId shardId, Accountable accountable) { "_doc", new CompressedXContent( Strings.toString( - PutMappingRequest.buildFromSimplifiedDef( + PutMappingRequest.simpleMapping( TEXT_FIELD_NAME, "type=text", KEYWORD_FIELD_NAME, diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java index fb4831f881092..fe65d14bbcd0f 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java @@ -320,7 +320,7 @@ protected IndexService createIndex(String index, Settings settings, String type, * @deprecated types are being removed */ @Deprecated - protected IndexService createIndex(String index, Settings settings, String type, Object... mappings) { + protected IndexService createIndex(String index, Settings settings, String type, String... mappings) { CreateIndexRequestBuilder createIndexRequestBuilder = client().admin().indices().prepareCreate(index).setSettings(settings); if (type != null) { createIndexRequestBuilder.addMapping(type, mappings);