Skip to content

Commit

Permalink
Fix integration tests failures
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Singh <surajrider@gmail.com>
  • Loading branch information
dreamer-89 committed Feb 23, 2022
1 parent 33b06ee commit 08ca5dc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
import org.opensearch.rest.action.admin.indices.RestGetIndexTemplateAction;
import org.opensearch.rest.action.admin.indices.RestGetIndicesAction;
import org.opensearch.rest.action.admin.indices.RestPutIndexTemplateAction;
import org.opensearch.rest.action.admin.indices.RestPutMappingAction;
import org.opensearch.rest.action.admin.indices.RestRolloverIndexAction;

import java.io.IOException;
Expand Down Expand Up @@ -580,32 +579,6 @@ public void testPutMapping() throws IOException {
assertEquals("text", XContentMapValues.extractValue(indexName + ".mappings.properties.field.type", getIndexResponse));
}

public void testPutMappingWithTypes() throws IOException {
String indexName = "mapping_index";
createIndex(indexName, Settings.EMPTY);

org.opensearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest =
new org.opensearch.action.admin.indices.mapping.put.PutMappingRequest(indexName);
putMappingRequest.type("some_type");

XContentBuilder mappingBuilder = JsonXContent.contentBuilder();
mappingBuilder.startObject().startObject("properties").startObject("field");
mappingBuilder.field("type", "text");
mappingBuilder.endObject().endObject().endObject();
putMappingRequest.source(mappingBuilder);

AcknowledgedResponse putMappingResponse = execute(
putMappingRequest,
highLevelClient().indices()::putMapping,
highLevelClient().indices()::putMappingAsync,
expectWarningsOnce(RestPutMappingAction.TYPES_DEPRECATION_MESSAGE)
);
assertTrue(putMappingResponse.isAcknowledged());

Map<String, Object> getIndexResponse = getAsMap(indexName);
assertEquals("text", XContentMapValues.extractValue(indexName + ".mappings.properties.field.type", getIndexResponse));
}

public void testGetMapping() throws IOException {
String indexName = "test";
createIndex(indexName, Settings.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,6 @@
"":
type: keyword

---
"Put mappings with explicit _doc type":
- skip:
version: " - 6.99.99"
reason: include_type_name defaults to true before 7.0

- do:
indices.create:
index: test_index

- do:
catch: bad_request
indices.put_mapping:
index: test_index
body:
_doc:
properties:
field:
type: keyword

- match: { error.type: "illegal_argument_exception" }
- match: { error.reason: "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true." }

---
"Update per-field metadata":

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

- do:
indices.put_mapping:
include_type_name: false
index: index
body:
properties:
Expand All @@ -30,7 +29,6 @@

- do:
indices.put_mapping:
include_type_name: false
index: index
body:
properties:
Expand All @@ -40,7 +38,6 @@
- do:
catch: /the final mapping would have more than 1 type/
indices.put_mapping:
include_type_name: true
index: index
type: some_other_type
body:
Expand All @@ -60,7 +57,6 @@

- do:
indices.create:
include_type_name: true
index: index
body:
mappings:
Expand All @@ -72,7 +68,6 @@
- do:
catch: /the final mapping would have more than 1 type/
indices.put_mapping:
include_type_name: true
index: index
type: _doc
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.opensearch.action.support.IndicesOptions;
import org.opensearch.client.node.NodeClient;
import org.opensearch.common.Strings;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.index.mapper.MapperService;
import org.opensearch.rest.BaseRestHandler;
Expand All @@ -50,7 +49,6 @@
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import static org.opensearch.client.Requests.putMappingRequest;
import static org.opensearch.index.mapper.MapperService.isMappingSourceTyped;
import static org.opensearch.rest.RestRequest.Method.POST;
import static org.opensearch.rest.RestRequest.Method.PUT;

Expand Down

0 comments on commit 08ca5dc

Please sign in to comment.