diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java index bef0aa6a8f474..79b0646770845 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java @@ -57,6 +57,8 @@ import java.io.IOException; import java.util.Locale; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; + final class IndicesRequestConverters { private IndicesRequestConverters() {} @@ -103,6 +105,7 @@ static Request createIndex(CreateIndexRequest createIndexRequest) throws IOExcep parameters.withTimeout(createIndexRequest.timeout()); parameters.withMasterTimeout(createIndexRequest.masterNodeTimeout()); parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards()); + parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); request.setEntity(RequestConverters.createEntity(createIndexRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); return request; @@ -131,6 +134,7 @@ static Request putMapping(PutMappingRequest putMappingRequest) throws IOExceptio RequestConverters.Params parameters = new RequestConverters.Params(request); parameters.withTimeout(putMappingRequest.timeout()); parameters.withMasterTimeout(putMappingRequest.masterNodeTimeout()); + parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); return request; @@ -146,6 +150,8 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) throws IOExcep parameters.withMasterTimeout(getMappingsRequest.masterNodeTimeout()); parameters.withIndicesOptions(getMappingsRequest.indicesOptions()); parameters.withLocal(getMappingsRequest.local()); + parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); + return request; } @@ -165,6 +171,8 @@ static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest) parameters.withIndicesOptions(getFieldMappingsRequest.indicesOptions()); parameters.withIncludeDefaults(getFieldMappingsRequest.includeDefaults()); parameters.withLocal(getFieldMappingsRequest.local()); + parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); + return request; } @@ -357,6 +365,7 @@ static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) thro if (Strings.hasText(putIndexTemplateRequest.cause())) { params.putParam("cause", putIndexTemplateRequest.cause()); } + params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); request.setEntity(RequestConverters.createEntity(putIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); return request; } @@ -395,6 +404,7 @@ static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest) { final RequestConverters.Params params = new RequestConverters.Params(request); params.withLocal(getIndexTemplatesRequest.isLocal()); params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout()); + params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true"); return request; } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java index 19a5b03b6d6cd..eddb6b5758452 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java @@ -255,9 +255,7 @@ public void testSourceDoesNotExist() throws IOException { .put("number_of_shards", 1) .put("number_of_replicas", 0) .build(); - String mapping = "\"_doc\": { \"_source\": {\n" + - " \"enabled\": false\n" + - " } }"; + String mapping = "\"_source\": {\"enabled\": false}"; createIndex(noSourceIndex, settings, mapping); assertEquals( RestStatus.OK, @@ -1242,7 +1240,7 @@ public void testTermvectors() throws IOException { .put("number_of_shards", 1) .put("number_of_replicas", 0) .build(); - String mappings = "\"_doc\":{\"properties\":{\"field\":{\"type\":\"text\"}}}"; + String mappings = "\"properties\":{\"field\":{\"type\":\"text\"}}"; createIndex(sourceIndex, settings, mappings); assertEquals( RestStatus.OK, @@ -1318,7 +1316,7 @@ public void testMultiTermvectors() throws IOException { .put("number_of_shards", 1) .put("number_of_replicas", 0) .build(); - String mappings = "\"_doc\":{\"properties\":{\"field\":{\"type\":\"text\"}}}"; + String mappings = "\"properties\":{\"field\":{\"type\":\"text\"}}"; createIndex(sourceIndex, settings, mappings); assertEquals( RestStatus.OK, diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java index 92d7e94394594..f3a2fd2baaa3a 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java @@ -341,7 +341,7 @@ public void testGetIndex() throws IOException { .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) .build(); - String mappings = "\"_doc\":{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}"; + String mappings = "\"properties\":{\"field-1\":{\"type\":\"integer\"}}"; createIndex(indexName, basicSettings, mappings); GetIndexRequest getIndexRequest = new GetIndexRequest() @@ -371,7 +371,7 @@ public void testGetIndexWithDefaults() throws IOException { .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) .build(); - String mappings = "\"_doc\":{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}"; + String mappings = "\"properties\":{\"field-1\":{\"type\":\"integer\"}}"; createIndex(indexName, basicSettings, mappings); GetIndexRequest getIndexRequest = new GetIndexRequest() @@ -1251,8 +1251,8 @@ public void testPutTemplate() throws Exception { assertThat(extractRawValues("my-template.index_patterns", templates), contains("pattern-1", "name-*")); assertThat(extractValue("my-template.settings.index.number_of_shards", templates), equalTo("3")); assertThat(extractValue("my-template.settings.index.number_of_replicas", templates), equalTo("0")); - assertThat(extractValue("my-template.mappings.doc.properties.host_name.type", templates), equalTo("keyword")); - assertThat(extractValue("my-template.mappings.doc.properties.description.type", templates), equalTo("text")); + assertThat(extractValue("my-template.mappings.properties.host_name.type", templates), equalTo("keyword")); + assertThat(extractValue("my-template.mappings.properties.description.type", templates), equalTo("text")); assertThat((Map) extractValue("my-template.aliases.alias-1", templates), hasEntry("index_routing", "abc")); assertThat((Map) extractValue("my-template.aliases.{index}-write", templates), hasEntry("search_routing", "xyz")); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java index 010cf04b73766..663c40b17a8b2 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java @@ -78,6 +78,7 @@ import static org.elasticsearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest; import static org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings; import static org.elasticsearch.index.alias.RandomAliasActionsGenerator.randomAliasAction; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -132,6 +133,7 @@ public void testCreateIndex() throws IOException { RequestConvertersTests.setRandomTimeout(createIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); RequestConvertersTests.setRandomMasterTimeout(createIndexRequest, expectedParams); RequestConvertersTests.setRandomWaitForActiveShards(createIndexRequest::waitForActiveShards, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); Request request = IndicesRequestConverters.createIndex(createIndexRequest); Assert.assertEquals("/" + createIndexRequest.index(), request.getEndpoint()); @@ -173,6 +175,7 @@ public void testPutMapping() throws IOException { RequestConvertersTests.setRandomTimeout(putMappingRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); RequestConvertersTests.setRandomMasterTimeout(putMappingRequest, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); Request request = IndicesRequestConverters.putMapping(putMappingRequest); StringJoiner endpoint = new StringJoiner("/", "/", ""); @@ -214,6 +217,7 @@ public void testGetMapping() throws IOException { getMappingRequest::indicesOptions, expectedParams); RequestConvertersTests.setRandomMasterTimeout(getMappingRequest, expectedParams); RequestConvertersTests.setRandomLocal(getMappingRequest, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); Request request = IndicesRequestConverters.getMappings(getMappingRequest); StringJoiner endpoint = new StringJoiner("/", "/", ""); @@ -266,6 +270,7 @@ public void testGetFieldMapping() throws IOException { RequestConvertersTests.setRandomIndicesOptions(getFieldMappingsRequest::indicesOptions, getFieldMappingsRequest::indicesOptions, expectedParams); RequestConvertersTests.setRandomLocal(getFieldMappingsRequest::local, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); Request request = IndicesRequestConverters.getFieldMapping(getFieldMappingsRequest); StringJoiner endpoint = new StringJoiner("/", "/", ""); @@ -835,6 +840,8 @@ public void testPutTemplateRequest() throws Exception { expectedParams.put("cause", cause); } RequestConvertersTests.setRandomMasterTimeout(putTemplateRequest, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); + Request request = IndicesRequestConverters.putTemplate(putTemplateRequest); Assert.assertThat(request.getEndpoint(), equalTo("/_template/" + names.get(putTemplateRequest.name()))); Assert.assertThat(request.getParameters(), equalTo(expectedParams)); @@ -888,6 +895,8 @@ public void testGetTemplateRequest() throws Exception { Map expectedParams = new HashMap<>(); RequestConvertersTests.setRandomMasterTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams); RequestConvertersTests.setRandomLocal(getTemplatesRequest::setLocal, expectedParams); + expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); + Request request = IndicesRequestConverters.getTemplates(getTemplatesRequest); Assert.assertThat(request.getEndpoint(), equalTo("/_template/" + names.stream().map(encodes::get).collect(Collectors.joining(",")))); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java index fad42d3c44c45..bf16ce93c147d 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java @@ -140,11 +140,9 @@ public void indexDocuments() throws IOException { create.setJsonEntity( "{" + " \"mappings\": {" + - " \"_doc\": {" + - " \"properties\": {" + - " \"rating\": {" + - " \"type\": \"keyword\"" + - " }" + + " \"properties\": {" + + " \"rating\": {" + + " \"type\": \"keyword\"" + " }" + " }" + " }" + @@ -172,16 +170,14 @@ public void indexDocuments() throws IOException { create.setJsonEntity( "{" + " \"mappings\": {" + - " \"_doc\": {" + - " \"properties\": {" + - " \"field1\": {" + - " \"type\": \"keyword\"," + - " \"store\": true" + - " }," + - " \"field2\": {" + - " \"type\": \"keyword\"," + - " \"store\": true" + - " }" + + " \"properties\": {" + + " \"field1\": {" + + " \"type\": \"keyword\"," + + " \"store\": true" + + " }," + + " \"field2\": {" + + " \"type\": \"keyword\"," + + " \"store\": true" + " }" + " }" + " }" + @@ -445,12 +441,10 @@ public void testSearchWithParentJoin() throws IOException { createIndex.setJsonEntity( "{\n" + " \"mappings\": {\n" + - " \"_doc\" : {\n" + - " \"properties\" : {\n" + - " \"qa_join_field\" : {\n" + - " \"type\" : \"join\",\n" + - " \"relations\" : { \"question\" : \"answer\" }\n" + - " }\n" + + " \"properties\" : {\n" + + " \"qa_join_field\" : {\n" + + " \"type\" : \"join\",\n" + + " \"relations\" : { \"question\" : \"answer\" }\n" + " }\n" + " }\n" + " }" + diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java index 894b569f614f3..5033d271261df 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java @@ -792,17 +792,15 @@ public void testReindex() throws Exception { RestHighLevelClient client = highLevelClient(); { String mapping = - "\"_doc\": {\n" + - " \"properties\": {\n" + - " \"user\": {\n" + - " \"type\": \"text\"\n" + - " },\n" + - " \"field1\": {\n" + - " \"type\": \"integer\"\n" + - " },\n" + - " \"field2\": {\n" + - " \"type\": \"integer\"\n" + - " }\n" + + " \"properties\": {\n" + + " \"user\": {\n" + + " \"type\": \"text\"\n" + + " },\n" + + " \"field1\": {\n" + + " \"type\": \"integer\"\n" + + " },\n" + + " \"field2\": {\n" + + " \"type\": \"integer\"\n" + " }\n" + " }"; createIndex("source1", Settings.EMPTY, mapping); @@ -1000,19 +998,17 @@ public void testUpdateByQuery() throws Exception { RestHighLevelClient client = highLevelClient(); { String mapping = - "\"_doc\": {\n" + - " \"properties\": {\n" + - " \"user\": {\n" + - " \"type\": \"text\"\n" + - " },\n" + - " \"field1\": {\n" + - " \"type\": \"integer\"\n" + - " },\n" + - " \"field2\": {\n" + - " \"type\": \"integer\"\n" + - " }\n" + - " }\n" + - " }"; + " \"properties\": {\n" + + " \"user\": {\n" + + " \"type\": \"text\"\n" + + " },\n" + + " \"field1\": {\n" + + " \"type\": \"integer\"\n" + + " },\n" + + " \"field2\": {\n" + + " \"type\": \"integer\"\n" + + " }\n" + + " }"; createIndex("source1", Settings.EMPTY, mapping); createIndex("source2", Settings.EMPTY, mapping); createPipeline("my_pipeline"); @@ -1125,19 +1121,17 @@ public void testDeleteByQuery() throws Exception { RestHighLevelClient client = highLevelClient(); { String mapping = - "\"_doc\": {\n" + - " \"properties\": {\n" + - " \"user\": {\n" + - " \"type\": \"text\"\n" + - " },\n" + - " \"field1\": {\n" + - " \"type\": \"integer\"\n" + - " },\n" + - " \"field2\": {\n" + - " \"type\": \"integer\"\n" + - " }\n" + - " }\n" + - " }"; + " \"properties\": {\n" + + " \"user\": {\n" + + " \"type\": \"text\"\n" + + " },\n" + + " \"field1\": {\n" + + " \"type\": \"integer\"\n" + + " },\n" + + " \"field2\": {\n" + + " \"type\": \"integer\"\n" + + " }\n" + + " }"; createIndex("source1", Settings.EMPTY, mapping); createIndex("source2", Settings.EMPTY, mapping); } diff --git a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RequestsWithoutContentIT.java b/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RequestsWithoutContentIT.java index a6fc7b9cce18e..4d27f156b3826 100644 --- a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RequestsWithoutContentIT.java +++ b/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RequestsWithoutContentIT.java @@ -48,7 +48,7 @@ public void testPutSettingsMissingBody() throws IOException { public void testPutMappingsMissingBody() throws IOException { ResponseException responseException = expectThrows(ResponseException.class, () -> - client().performRequest(new Request(randomBoolean() ? "POST" : "PUT", "/test_index/test_type/_mapping"))); + client().performRequest(new Request(randomBoolean() ? "POST" : "PUT", "/test_index/_mapping"))); assertResponseException(responseException, "request body is required"); } diff --git a/docs/build.gradle b/docs/build.gradle index 035667ee84309..91086ce1f346d 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -525,6 +525,7 @@ for (int i = 0; i < 5; i++) { buildRestTests.setups['library'] = ''' - do: indices.create: + include_type_name: true index: library body: settings: diff --git a/docs/painless/painless-contexts/painless-context-examples.asciidoc b/docs/painless/painless-contexts/painless-context-examples.asciidoc index 469f425d1d89f..79fe9056aba95 100644 --- a/docs/painless/painless-contexts/painless-context-examples.asciidoc +++ b/docs/painless/painless-contexts/painless-context-examples.asciidoc @@ -43,7 +43,7 @@ the request URL. + [source,js] ---- -PUT /seats +PUT /seats?include_type_name=true { "mappings": { "seat": { diff --git a/docs/painless/painless-execute-script.asciidoc b/docs/painless/painless-execute-script.asciidoc index 200dd3f63d56f..3b1b03ca3b698 100644 --- a/docs/painless/painless-execute-script.asciidoc +++ b/docs/painless/painless-execute-script.asciidoc @@ -71,7 +71,7 @@ index:: The name of an index containing a mapping that is compatible with the do [source,js] ---------------------------------------------------------------- -PUT /my-index +PUT /my-index?include_type_name=true { "mappings": { "_doc": { @@ -129,7 +129,7 @@ query:: If `_score` is used in the script then a query can specified that will b [source,js] ---------------------------------------------------------------- -PUT /my-index +PUT /my-index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/plugins/analysis-icu.asciidoc b/docs/plugins/analysis-icu.asciidoc index 80939496931af..a29acf7f2b0ee 100644 --- a/docs/plugins/analysis-icu.asciidoc +++ b/docs/plugins/analysis-icu.asciidoc @@ -64,7 +64,7 @@ Here are two examples, the default usage and a customised character filter: [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { @@ -112,7 +112,7 @@ using custom rules to break Myanmar and Khmer text into syllables. [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { @@ -153,7 +153,7 @@ Then create an analyzer to use this rule file as follows: [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index":{ @@ -221,7 +221,7 @@ Here are two examples, the default usage and a customised token filter: [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { @@ -267,7 +267,7 @@ available to all indices: [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { @@ -301,7 +301,7 @@ these filtered character are not lowercased which is why we add the [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { @@ -354,7 +354,7 @@ Below is an example of how to set up a field for sorting German names in [source,js] -------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -503,7 +503,7 @@ For example: [source,js] -------------------------------------------------- -PUT icu_sample +PUT icu_sample?include_type_name=true { "settings": { "index": { diff --git a/docs/plugins/analysis-kuromoji.asciidoc b/docs/plugins/analysis-kuromoji.asciidoc index 383df5afb485b..fe7ed1cc317b9 100644 --- a/docs/plugins/analysis-kuromoji.asciidoc +++ b/docs/plugins/analysis-kuromoji.asciidoc @@ -124,7 +124,7 @@ Then create an analyzer as follows: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { @@ -186,7 +186,7 @@ BaseFormAttribute. This acts as a lemmatizer for verbs and adjectives. Example: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { @@ -243,7 +243,7 @@ For example: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { @@ -317,7 +317,7 @@ katakana reading form: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index":{ @@ -381,7 +381,7 @@ This token filter accepts the following setting: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { @@ -434,7 +434,7 @@ predefined list, then use the [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { @@ -493,7 +493,7 @@ to regular Arabic decimal numbers in half-width characters. For example: [source,js] -------------------------------------------------- -PUT kuromoji_sample +PUT kuromoji_sample?include_type_name=true { "settings": { "index": { diff --git a/docs/plugins/analysis-nori.asciidoc b/docs/plugins/analysis-nori.asciidoc index 68ec943533aa9..1fe21fa13da97 100644 --- a/docs/plugins/analysis-nori.asciidoc +++ b/docs/plugins/analysis-nori.asciidoc @@ -90,7 +90,7 @@ Then create an analyzer as follows: [source,js] -------------------------------------------------- -PUT nori_sample +PUT nori_sample?include_type_name=true { "settings": { "index": { @@ -164,7 +164,7 @@ the `user_dictionary_rules` option: [source,js] -------------------------------------------------- -PUT nori_sample +PUT nori_sample?include_type_name=true { "settings": { "index": { @@ -332,7 +332,7 @@ For example: [source,js] -------------------------------------------------- -PUT nori_sample +PUT nori_sample?include_type_name=true { "settings": { "index": { @@ -398,7 +398,7 @@ The `nori_readingform` token filter rewrites tokens written in Hanja to their Ha [source,js] -------------------------------------------------- -PUT nori_sample +PUT nori_sample?include_type_name=true { "settings": { "index":{ diff --git a/docs/plugins/analysis-phonetic.asciidoc b/docs/plugins/analysis-phonetic.asciidoc index e22f819e1eb3e..7996edb6afba3 100644 --- a/docs/plugins/analysis-phonetic.asciidoc +++ b/docs/plugins/analysis-phonetic.asciidoc @@ -29,7 +29,7 @@ The `phonetic` token filter takes the following settings: [source,js] -------------------------------------------------- -PUT phonetic_sample +PUT phonetic_sample?include_type_name=true { "settings": { "index": { diff --git a/docs/plugins/mapper-annotated-text.asciidoc b/docs/plugins/mapper-annotated-text.asciidoc index 4528168a4d643..d026b8a98b2f9 100644 --- a/docs/plugins/mapper-annotated-text.asciidoc +++ b/docs/plugins/mapper-annotated-text.asciidoc @@ -24,7 +24,7 @@ the search index: [source,js] -------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -168,7 +168,7 @@ sense to include them in dedicated structured fields to support discovery via ag [source,js] -------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/plugins/mapper-murmur3.asciidoc b/docs/plugins/mapper-murmur3.asciidoc index 49dbaa77d58bb..dc6d055d40096 100644 --- a/docs/plugins/mapper-murmur3.asciidoc +++ b/docs/plugins/mapper-murmur3.asciidoc @@ -16,7 +16,7 @@ value and its hash are stored in the index: [source,js] -------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/plugins/mapper-size.asciidoc b/docs/plugins/mapper-size.asciidoc index b60856a848923..141cf382568bf 100644 --- a/docs/plugins/mapper-size.asciidoc +++ b/docs/plugins/mapper-size.asciidoc @@ -15,7 +15,7 @@ In order to enable the `_size` field, set the mapping as follows: [source,js] -------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/plugins/store-smb.asciidoc b/docs/plugins/store-smb.asciidoc index 4f713568655cb..e0649873f8794 100644 --- a/docs/plugins/store-smb.asciidoc +++ b/docs/plugins/store-smb.asciidoc @@ -46,7 +46,7 @@ It can also be set on a per-index basis at index creation time: [source,js] ---- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.store.type": "smb_mmap_fs" diff --git a/docs/reference/aggregations/bucket/children-aggregation.asciidoc b/docs/reference/aggregations/bucket/children-aggregation.asciidoc index dc17157e9102a..7a06d218b357f 100644 --- a/docs/reference/aggregations/bucket/children-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/children-aggregation.asciidoc @@ -11,7 +11,7 @@ For example, let's say we have an index of questions and answers. The answer typ [source,js] -------------------------------------------------- -PUT child_example +PUT child_example?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/bucket/composite-aggregation.asciidoc b/docs/reference/aggregations/bucket/composite-aggregation.asciidoc index 1a63f29467d4b..cc4d778bff032 100644 --- a/docs/reference/aggregations/bucket/composite-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/composite-aggregation.asciidoc @@ -16,7 +16,7 @@ a composite bucket. [source,js] -------------------------------------------------- -PUT /sales +PUT /sales?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/bucket/geodistance-aggregation.asciidoc b/docs/reference/aggregations/bucket/geodistance-aggregation.asciidoc index 9be9b73e38d49..aafcc808530a3 100644 --- a/docs/reference/aggregations/bucket/geodistance-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/geodistance-aggregation.asciidoc @@ -5,7 +5,7 @@ A multi-bucket aggregation that works on `geo_point` fields and conceptually wor [source,js] -------------------------------------------------- -PUT /museums +PUT /museums?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/bucket/geohashgrid-aggregation.asciidoc b/docs/reference/aggregations/bucket/geohashgrid-aggregation.asciidoc index 91c6688b10bd5..bfaec5ee8254f 100644 --- a/docs/reference/aggregations/bucket/geohashgrid-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/geohashgrid-aggregation.asciidoc @@ -19,7 +19,7 @@ The specified field must be of type `geo_point` (which can only be set explicitl [source,js] -------------------------------------------------- -PUT /museums +PUT /museums?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/bucket/nested-aggregation.asciidoc b/docs/reference/aggregations/bucket/nested-aggregation.asciidoc index 5d2d904f0eb7f..2acf760fff3d1 100644 --- a/docs/reference/aggregations/bucket/nested-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/nested-aggregation.asciidoc @@ -8,7 +8,7 @@ price for the product. The mapping could look like: [source,js] -------------------------------------------------- -PUT /index +PUT /index?include_type_name=true { "mappings": { "product" : { diff --git a/docs/reference/aggregations/bucket/parent-aggregation.asciidoc b/docs/reference/aggregations/bucket/parent-aggregation.asciidoc index 572357c01c1b5..3e0a1606ce277 100644 --- a/docs/reference/aggregations/bucket/parent-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/parent-aggregation.asciidoc @@ -11,7 +11,7 @@ For example, let's say we have an index of questions and answers. The answer typ [source,js] -------------------------------------------------- -PUT parent_example +PUT parent_example?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/bucket/reverse-nested-aggregation.asciidoc b/docs/reference/aggregations/bucket/reverse-nested-aggregation.asciidoc index f45629b14e746..493326651ef99 100644 --- a/docs/reference/aggregations/bucket/reverse-nested-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/reverse-nested-aggregation.asciidoc @@ -17,7 +17,7 @@ the issue documents as nested documents. The mapping could look like: [source,js] -------------------------------------------------- -PUT /issues +PUT /issues?include_type_name=true { "mappings": { "issue" : { diff --git a/docs/reference/aggregations/bucket/significantterms-aggregation.asciidoc b/docs/reference/aggregations/bucket/significantterms-aggregation.asciidoc index bfaeecc1f82d3..0b2b769adfcbd 100644 --- a/docs/reference/aggregations/bucket/significantterms-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/significantterms-aggregation.asciidoc @@ -19,7 +19,7 @@ that is significant and probably very relevant to their search. 5/10,000,000 vs [source,js] -------------------------------------------------- -PUT /reports +PUT /reports?include_type_name=true { "mappings": { "report": { diff --git a/docs/reference/aggregations/bucket/terms-aggregation.asciidoc b/docs/reference/aggregations/bucket/terms-aggregation.asciidoc index 188b2ed3774c0..3b104c90332ae 100644 --- a/docs/reference/aggregations/bucket/terms-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/terms-aggregation.asciidoc @@ -7,7 +7,7 @@ A multi-bucket value source based aggregation where buckets are dynamically buil [source,js] -------------------------------------------------- -PUT /products +PUT /products?include_type_name=true { "mappings": { "product": { diff --git a/docs/reference/aggregations/metrics/geobounds-aggregation.asciidoc b/docs/reference/aggregations/metrics/geobounds-aggregation.asciidoc index 6a2be84d6e54f..fc9765a330711 100644 --- a/docs/reference/aggregations/metrics/geobounds-aggregation.asciidoc +++ b/docs/reference/aggregations/metrics/geobounds-aggregation.asciidoc @@ -8,7 +8,7 @@ Example: [source,js] -------------------------------------------------- -PUT /museums +PUT /museums?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/metrics/geocentroid-aggregation.asciidoc b/docs/reference/aggregations/metrics/geocentroid-aggregation.asciidoc index 102c9f21b262f..0ccd58e0dc63c 100644 --- a/docs/reference/aggregations/metrics/geocentroid-aggregation.asciidoc +++ b/docs/reference/aggregations/metrics/geocentroid-aggregation.asciidoc @@ -7,7 +7,7 @@ Example: [source,js] -------------------------------------------------- -PUT /museums +PUT /museums?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/aggregations/metrics/tophits-aggregation.asciidoc b/docs/reference/aggregations/metrics/tophits-aggregation.asciidoc index 1d225c91e26d8..485e900d9628c 100644 --- a/docs/reference/aggregations/metrics/tophits-aggregation.asciidoc +++ b/docs/reference/aggregations/metrics/tophits-aggregation.asciidoc @@ -240,7 +240,7 @@ Let's see how it works with a real sample. Considering the following mapping: [source,js] -------------------------------------------------- -PUT /sales +PUT /sales?include_type_name=true { "mappings": { "_doc" : { diff --git a/docs/reference/analysis.asciidoc b/docs/reference/analysis.asciidoc index c5fcce3ad5fa9..11a8527bbc61a 100644 --- a/docs/reference/analysis.asciidoc +++ b/docs/reference/analysis.asciidoc @@ -39,7 +39,7 @@ Each <> field in a mapping can specify its own [source,js] ------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/analysis/analyzers/configuring.asciidoc b/docs/reference/analysis/analyzers/configuring.asciidoc index 8ed4c09b4d32a..f010f2ad6e9b1 100644 --- a/docs/reference/analysis/analyzers/configuring.asciidoc +++ b/docs/reference/analysis/analyzers/configuring.asciidoc @@ -8,7 +8,7 @@ to support a list of stop words: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/custom-analyzer.asciidoc b/docs/reference/analysis/analyzers/custom-analyzer.asciidoc index 92133822fa51f..153f0fe539e1a 100644 --- a/docs/reference/analysis/analyzers/custom-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/custom-analyzer.asciidoc @@ -53,7 +53,7 @@ Token Filters:: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -157,7 +157,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/fingerprint-analyzer.asciidoc b/docs/reference/analysis/analyzers/fingerprint-analyzer.asciidoc index cc82d2eb8179f..28df6d2d3bcf4 100644 --- a/docs/reference/analysis/analyzers/fingerprint-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/fingerprint-analyzer.asciidoc @@ -86,7 +86,7 @@ pre-defined list of English stop words: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -158,7 +158,7 @@ customization: [source,js] ---------------------------------------------------- -PUT /fingerprint_example +PUT /fingerprint_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/keyword-analyzer.asciidoc b/docs/reference/analysis/analyzers/keyword-analyzer.asciidoc index 954b514ced605..571ff953c95c3 100644 --- a/docs/reference/analysis/analyzers/keyword-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/keyword-analyzer.asciidoc @@ -68,7 +68,7 @@ for further customization: [source,js] ---------------------------------------------------- -PUT /keyword_example +PUT /keyword_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/lang-analyzer.asciidoc b/docs/reference/analysis/analyzers/lang-analyzer.asciidoc index 9a4dcbe8aaac7..959504dbbd608 100644 --- a/docs/reference/analysis/analyzers/lang-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/lang-analyzer.asciidoc @@ -78,7 +78,7 @@ The `arabic` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /arabic_example +PUT /arabic_example?include_type_name=true { "settings": { "analysis": { @@ -128,7 +128,7 @@ The `armenian` analyzer could be reimplemented as a `custom` analyzer as follows [source,js] ---------------------------------------------------- -PUT /armenian_example +PUT /armenian_example?include_type_name=true { "settings": { "analysis": { @@ -176,7 +176,7 @@ The `basque` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /basque_example +PUT /basque_example?include_type_name=true { "settings": { "analysis": { @@ -224,7 +224,7 @@ The `bengali` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /bengali_example +PUT /bengali_example?include_type_name=true { "settings": { "analysis": { @@ -275,7 +275,7 @@ The `brazilian` analyzer could be reimplemented as a `custom` analyzer as follow [source,js] ---------------------------------------------------- -PUT /brazilian_example +PUT /brazilian_example?include_type_name=true { "settings": { "analysis": { @@ -323,7 +323,7 @@ The `bulgarian` analyzer could be reimplemented as a `custom` analyzer as follow [source,js] ---------------------------------------------------- -PUT /bulgarian_example +PUT /bulgarian_example?include_type_name=true { "settings": { "analysis": { @@ -371,7 +371,7 @@ The `catalan` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /catalan_example +PUT /catalan_example?include_type_name=true { "settings": { "analysis": { @@ -428,7 +428,7 @@ The `cjk` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /cjk_example +PUT /cjk_example?include_type_name=true { "settings": { "analysis": { @@ -474,7 +474,7 @@ The `czech` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /czech_example +PUT /czech_example?include_type_name=true { "settings": { "analysis": { @@ -522,7 +522,7 @@ The `danish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /danish_example +PUT /danish_example?include_type_name=true { "settings": { "analysis": { @@ -570,7 +570,7 @@ The `dutch` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /dutch_example +PUT /dutch_example?include_type_name=true { "settings": { "analysis": { @@ -628,7 +628,7 @@ The `english` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /english_example +PUT /english_example?include_type_name=true { "settings": { "analysis": { @@ -681,7 +681,7 @@ The `finnish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /finnish_example +PUT /finnish_example?include_type_name=true { "settings": { "analysis": { @@ -729,7 +729,7 @@ The `french` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /french_example +PUT /french_example?include_type_name=true { "settings": { "analysis": { @@ -787,7 +787,7 @@ The `galician` analyzer could be reimplemented as a `custom` analyzer as follows [source,js] ---------------------------------------------------- -PUT /galician_example +PUT /galician_example?include_type_name=true { "settings": { "analysis": { @@ -835,7 +835,7 @@ The `german` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /german_example +PUT /german_example?include_type_name=true { "settings": { "analysis": { @@ -884,7 +884,7 @@ The `greek` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /greek_example +PUT /greek_example?include_type_name=true { "settings": { "analysis": { @@ -936,7 +936,7 @@ The `hindi` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /hindi_example +PUT /hindi_example?include_type_name=true { "settings": { "analysis": { @@ -987,7 +987,7 @@ The `hungarian` analyzer could be reimplemented as a `custom` analyzer as follow [source,js] ---------------------------------------------------- -PUT /hungarian_example +PUT /hungarian_example?include_type_name=true { "settings": { "analysis": { @@ -1036,7 +1036,7 @@ The `indonesian` analyzer could be reimplemented as a `custom` analyzer as follo [source,js] ---------------------------------------------------- -PUT /indonesian_example +PUT /indonesian_example?include_type_name=true { "settings": { "analysis": { @@ -1084,7 +1084,7 @@ The `irish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /irish_example +PUT /irish_example?include_type_name=true { "settings": { "analysis": { @@ -1148,7 +1148,7 @@ The `italian` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /italian_example +PUT /italian_example?include_type_name=true { "settings": { "analysis": { @@ -1207,7 +1207,7 @@ The `latvian` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /latvian_example +PUT /latvian_example?include_type_name=true { "settings": { "analysis": { @@ -1255,7 +1255,7 @@ The `lithuanian` analyzer could be reimplemented as a `custom` analyzer as follo [source,js] ---------------------------------------------------- -PUT /lithuanian_example +PUT /lithuanian_example?include_type_name=true { "settings": { "analysis": { @@ -1303,7 +1303,7 @@ The `norwegian` analyzer could be reimplemented as a `custom` analyzer as follow [source,js] ---------------------------------------------------- -PUT /norwegian_example +PUT /norwegian_example?include_type_name=true { "settings": { "analysis": { @@ -1351,7 +1351,7 @@ The `persian` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /persian_example +PUT /persian_example?include_type_name=true { "settings": { "analysis": { @@ -1397,7 +1397,7 @@ The `portuguese` analyzer could be reimplemented as a `custom` analyzer as follo [source,js] ---------------------------------------------------- -PUT /portuguese_example +PUT /portuguese_example?include_type_name=true { "settings": { "analysis": { @@ -1445,7 +1445,7 @@ The `romanian` analyzer could be reimplemented as a `custom` analyzer as follows [source,js] ---------------------------------------------------- -PUT /romanian_example +PUT /romanian_example?include_type_name=true { "settings": { "analysis": { @@ -1494,7 +1494,7 @@ The `russian` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /russian_example +PUT /russian_example?include_type_name=true { "settings": { "analysis": { @@ -1542,7 +1542,7 @@ The `sorani` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /sorani_example +PUT /sorani_example?include_type_name=true { "settings": { "analysis": { @@ -1592,7 +1592,7 @@ The `spanish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /spanish_example +PUT /spanish_example?include_type_name=true { "settings": { "analysis": { @@ -1640,7 +1640,7 @@ The `swedish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /swedish_example +PUT /swedish_example?include_type_name=true { "settings": { "analysis": { @@ -1688,7 +1688,7 @@ The `turkish` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /turkish_example +PUT /turkish_example?include_type_name=true { "settings": { "analysis": { @@ -1741,7 +1741,7 @@ The `thai` analyzer could be reimplemented as a `custom` analyzer as follows: [source,js] ---------------------------------------------------- -PUT /thai_example +PUT /thai_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/pattern-analyzer.asciidoc b/docs/reference/analysis/analyzers/pattern-analyzer.asciidoc index 027f37280a67d..759c781616926 100644 --- a/docs/reference/analysis/analyzers/pattern-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/pattern-analyzer.asciidoc @@ -177,7 +177,7 @@ on non-word characters or on underscores (`\W|_`), and to lower-case the result: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -266,7 +266,7 @@ The following more complicated example splits CamelCase text into tokens: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -386,7 +386,7 @@ customization: [source,js] ---------------------------------------------------- -PUT /pattern_example +PUT /pattern_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/simple-analyzer.asciidoc b/docs/reference/analysis/analyzers/simple-analyzer.asciidoc index d82655d9bd8e1..23130a4fd58ab 100644 --- a/docs/reference/analysis/analyzers/simple-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/simple-analyzer.asciidoc @@ -135,7 +135,7 @@ a starting point for further customization: [source,js] ---------------------------------------------------- -PUT /simple_example +PUT /simple_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/standard-analyzer.asciidoc b/docs/reference/analysis/analyzers/standard-analyzer.asciidoc index 3097ece21db23..959e493d9d5b0 100644 --- a/docs/reference/analysis/analyzers/standard-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/standard-analyzer.asciidoc @@ -151,7 +151,7 @@ pre-defined list of English stop words: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -283,7 +283,7 @@ it, usually by adding token filters. This would recreate the built-in [source,js] ---------------------------------------------------- -PUT /standard_example +PUT /standard_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/stop-analyzer.asciidoc b/docs/reference/analysis/analyzers/stop-analyzer.asciidoc index 1b84797d94761..2586d79c8443b 100644 --- a/docs/reference/analysis/analyzers/stop-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/stop-analyzer.asciidoc @@ -130,7 +130,7 @@ words as stop words: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -248,7 +248,7 @@ customization: [source,js] ---------------------------------------------------- -PUT /stop_example +PUT /stop_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/analyzers/whitespace-analyzer.asciidoc b/docs/reference/analysis/analyzers/whitespace-analyzer.asciidoc index 31ba8d9ce8f24..3ebc665abdd87 100644 --- a/docs/reference/analysis/analyzers/whitespace-analyzer.asciidoc +++ b/docs/reference/analysis/analyzers/whitespace-analyzer.asciidoc @@ -128,7 +128,7 @@ and you can use it as a starting point for further customization: [source,js] ---------------------------------------------------- -PUT /whitespace_example +PUT /whitespace_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/charfilters/htmlstrip-charfilter.asciidoc b/docs/reference/analysis/charfilters/htmlstrip-charfilter.asciidoc index 6c1a1875d67ca..a9e11cf778d3a 100644 --- a/docs/reference/analysis/charfilters/htmlstrip-charfilter.asciidoc +++ b/docs/reference/analysis/charfilters/htmlstrip-charfilter.asciidoc @@ -73,7 +73,7 @@ tags in place: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/charfilters/mapping-charfilter.asciidoc b/docs/reference/analysis/charfilters/mapping-charfilter.asciidoc index 30e565d443a3b..0cbc6de782d79 100644 --- a/docs/reference/analysis/charfilters/mapping-charfilter.asciidoc +++ b/docs/reference/analysis/charfilters/mapping-charfilter.asciidoc @@ -33,7 +33,7 @@ numerals with their Latin equivalents: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -107,7 +107,7 @@ example replaces the `:)` and `:(` emoticons with a text equivalent: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc b/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc index 046f6441c07b9..adfde27138af8 100644 --- a/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc +++ b/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc @@ -49,7 +49,7 @@ replace any embedded dashes in numbers with underscores, i.e `123-456-789` -> [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -100,7 +100,7 @@ camelCase words to be queried individually: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/normalizers.asciidoc b/docs/reference/analysis/normalizers.asciidoc index 80977d1d771df..64e69c3f56bf4 100644 --- a/docs/reference/analysis/normalizers.asciidoc +++ b/docs/reference/analysis/normalizers.asciidoc @@ -23,7 +23,7 @@ to get one is by building a custom one. Custom normalizers take a list of char [source,js] -------------------------------- -PUT index +PUT index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/testing.asciidoc b/docs/reference/analysis/testing.asciidoc index c8c7c3fa2b463..8102978635865 100644 --- a/docs/reference/analysis/testing.asciidoc +++ b/docs/reference/analysis/testing.asciidoc @@ -41,7 +41,7 @@ referred to when running the `analyze` API on a specific index: [source,js] ------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc index bd22b013334a9..77eb1bb05826d 100644 --- a/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc @@ -8,7 +8,7 @@ equivalents, if one exists. Example: [source,js] -------------------------------------------------- -PUT /asciifold_example +PUT /asciifold_example?include_type_name=true { "settings" : { "analysis" : { @@ -30,7 +30,7 @@ example: [source,js] -------------------------------------------------- -PUT /asciifold_example +PUT /asciifold_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc index cc26d025f04f9..a7ec4d9248546 100644 --- a/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc @@ -16,7 +16,7 @@ Bigrams are generated for characters in `han`, `hiragana`, `katakana` and [source,js] -------------------------------------------------- -PUT /cjk_bigram_example +PUT /cjk_bigram_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc index 361160ac6acc8..538e28a8cf0a1 100644 --- a/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc @@ -41,7 +41,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /common_grams_example +PUT /common_grams_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/compound-word-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/compound-word-tokenfilter.asciidoc index d200c0b988bc4..b345e0b7b4c08 100644 --- a/docs/reference/analysis/tokenfilters/compound-word-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/compound-word-tokenfilter.asciidoc @@ -84,7 +84,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /compound_word_example +PUT /compound_word_example?include_type_name=true { "settings": { "index": { diff --git a/docs/reference/analysis/tokenfilters/condition-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/condition-tokenfilter.asciidoc index cff05559ab9e6..e241bddb12b1d 100644 --- a/docs/reference/analysis/tokenfilters/condition-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/condition-tokenfilter.asciidoc @@ -20,7 +20,7 @@ You can set it up like: [source,js] -------------------------------------------------- -PUT /condition_example +PUT /condition_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc index 924903b9f65a8..7a28760194a71 100644 --- a/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc @@ -9,7 +9,7 @@ example: [source,js] -------------------------------------------------- -PUT /elision_example +PUT /elision_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/hunspell-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/hunspell-tokenfilter.asciidoc index cef687f761905..e68b6685a78e7 100644 --- a/docs/reference/analysis/tokenfilters/hunspell-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/hunspell-tokenfilter.asciidoc @@ -42,7 +42,7 @@ settings: [source,js] -------------------------------------------------- -PUT /hunspell_example +PUT /hunspell_example?include_type_name=true { "settings": { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/keep-types-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/keep-types-tokenfilter.asciidoc index 33a927c4b98bf..ac5b3f368b53e 100644 --- a/docs/reference/analysis/tokenfilters/keep-types-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/keep-types-tokenfilter.asciidoc @@ -19,7 +19,7 @@ You can set it up like: [source,js] -------------------------------------------------- -PUT /keep_types_example +PUT /keep_types_example?include_type_name=true { "settings" : { "analysis" : { @@ -80,7 +80,7 @@ If the `mode` parameter is set to `exclude` like in the following example: [source,js] -------------------------------------------------- -PUT /keep_types_exclude_example +PUT /keep_types_exclude_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/keep-words-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/keep-words-tokenfilter.asciidoc index b7385379be94b..1f1d49cfe89dc 100644 --- a/docs/reference/analysis/tokenfilters/keep-words-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/keep-words-tokenfilter.asciidoc @@ -20,7 +20,7 @@ keep_words_case:: a boolean indicating whether to lower case the words (defaults [source,js] -------------------------------------------------- -PUT /keep_words_example +PUT /keep_words_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc index 1f1e4e655c55e..8a12b0d4757af 100644 --- a/docs/reference/analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc @@ -23,7 +23,7 @@ You can configure it like: [source,js] -------------------------------------------------- -PUT /keyword_marker_example +PUT /keyword_marker_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc index 044e8c1476951..e0a2e4c73c96d 100644 --- a/docs/reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc @@ -14,7 +14,7 @@ preserve both the stemmed and unstemmed version of tokens: [source,js] -------------------------------------------------- -PUT /keyword_repeat_example +PUT /keyword_repeat_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc index ba2018c107626..deb13843a1ced 100644 --- a/docs/reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc @@ -18,7 +18,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /limit_example +PUT /limit_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc index 519fd77ba2afd..c0c35e8a60c9d 100644 --- a/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc @@ -10,7 +10,7 @@ custom analyzer [source,js] -------------------------------------------------- -PUT /lowercase_example +PUT /lowercase_example?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc index e2427071fbb69..8ad3fab8f36e7 100644 --- a/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc @@ -31,7 +31,7 @@ You can set it up like: [source,js] -------------------------------------------------- -PUT /multiplexer_example +PUT /multiplexer_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc index 5b935d31f1289..a028abef7a1f2 100644 --- a/docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc @@ -46,7 +46,7 @@ This is particularly useful for indexing text like camel-case code, eg [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "settings" : { "analysis" : { @@ -87,7 +87,7 @@ Another example is analyzing email addresses: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/predicate-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/predicate-tokenfilter.asciidoc index bebf7bd80f250..2e7f7c11631fe 100644 --- a/docs/reference/analysis/tokenfilters/predicate-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/predicate-tokenfilter.asciidoc @@ -17,7 +17,7 @@ You can set it up like: [source,js] -------------------------------------------------- -PUT /condition_example +PUT /condition_example?include_type_name=true { "settings" : { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc index 99ed03649ff93..c9f8eff813626 100644 --- a/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc @@ -12,7 +12,7 @@ For example: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc index e178181d1474a..b80bd517b1981 100644 --- a/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc @@ -20,7 +20,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis" : { @@ -53,7 +53,7 @@ You can also define the overrides rules inline: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/stemmer-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/stemmer-tokenfilter.asciidoc index f59e2f3f2cf88..f6db7206b04f6 100644 --- a/docs/reference/analysis/tokenfilters/stemmer-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/stemmer-tokenfilter.asciidoc @@ -6,7 +6,7 @@ filters through a single unified interface. For example: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis" : { diff --git a/docs/reference/analysis/tokenfilters/stop-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/stop-tokenfilter.asciidoc index 3167a4342ac2d..579d2202c00ed 100644 --- a/docs/reference/analysis/tokenfilters/stop-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/stop-tokenfilter.asciidoc @@ -33,7 +33,7 @@ The `stopwords` parameter accepts either an array of stopwords: [source,js] ------------------------------------ -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis": { @@ -53,7 +53,7 @@ or a predefined language-specific list: [source,js] ------------------------------------ -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc index 2a555d7d044da..d614a6bcf4d82 100644 --- a/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc @@ -23,7 +23,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -59,7 +59,7 @@ to note that only those synonym rules which cannot get parsed are ignored. For i [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -118,7 +118,7 @@ configuration file (note use of `synonyms` instead of `synonyms_path`): [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -150,7 +150,7 @@ declared using `format`: [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { diff --git a/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc index d0659f3425d3e..6bb42354c3556 100644 --- a/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc @@ -7,7 +7,7 @@ Here is an example: [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -46,7 +46,7 @@ to note that only those synonym rules which cannot get parsed are ignored. For i [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -106,7 +106,7 @@ configuration file (note use of `synonyms` instead of `synonyms_path`): [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { @@ -138,7 +138,7 @@ declared using `format`: [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "index" : { diff --git a/docs/reference/analysis/tokenizers/classic-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/classic-tokenizer.asciidoc index 52bdcbd773221..ca827e73ec6a8 100644 --- a/docs/reference/analysis/tokenizers/classic-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/classic-tokenizer.asciidoc @@ -145,7 +145,7 @@ In this example, we configure the `classic` tokenizer to have a [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc index a34f5c801939e..14f94ff21d3dc 100644 --- a/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc @@ -104,7 +104,7 @@ length `10`: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -222,7 +222,7 @@ Below is an example of how to set up a field for _search-as-you-type_: [source,js] ----------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/ngram-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/ngram-tokenizer.asciidoc index c182ffacd1cfe..c558a293927e0 100644 --- a/docs/reference/analysis/tokenizers/ngram-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/ngram-tokenizer.asciidoc @@ -209,7 +209,7 @@ digits as tokens, and to produce tri-grams (grams of length `3`): [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/pathhierarchy-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/pathhierarchy-tokenizer.asciidoc index 55aa7d66da343..b27c1fb7cefa3 100644 --- a/docs/reference/analysis/tokenizers/pathhierarchy-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/pathhierarchy-tokenizer.asciidoc @@ -93,7 +93,7 @@ characters, and to replace them with `/`. The first two tokens are skipped: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/pattern-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/pattern-tokenizer.asciidoc index 5c19fcf59cc92..de52ea31372a4 100644 --- a/docs/reference/analysis/tokenizers/pattern-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/pattern-tokenizer.asciidoc @@ -125,7 +125,7 @@ tokens when it encounters commas: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { @@ -215,7 +215,7 @@ escaped, so the pattern ends up looking like: [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/simplepattern-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/simplepattern-tokenizer.asciidoc index adc5fc05deeb9..2f68a0b8937c0 100644 --- a/docs/reference/analysis/tokenizers/simplepattern-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/simplepattern-tokenizer.asciidoc @@ -36,7 +36,7 @@ three-digit numbers [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/simplepatternsplit-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/simplepatternsplit-tokenizer.asciidoc index fc2e186f97267..d74f8823ff350 100644 --- a/docs/reference/analysis/tokenizers/simplepatternsplit-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/simplepatternsplit-tokenizer.asciidoc @@ -37,7 +37,7 @@ text on underscores. [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/standard-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/standard-tokenizer.asciidoc index 9f77a0e13dc88..b19f31188002f 100644 --- a/docs/reference/analysis/tokenizers/standard-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/standard-tokenizer.asciidoc @@ -136,7 +136,7 @@ In this example, we configure the `standard` tokenizer to have a [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/analysis/tokenizers/uaxurlemail-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/uaxurlemail-tokenizer.asciidoc index 7fea0f1e8d8aa..8df2bc507528e 100644 --- a/docs/reference/analysis/tokenizers/uaxurlemail-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/uaxurlemail-tokenizer.asciidoc @@ -92,7 +92,7 @@ In this example, we configure the `uax_url_email` tokenizer to have a [source,js] ---------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/cat/alias.asciidoc b/docs/reference/cat/alias.asciidoc index 394231e448dc0..9cf831249dda9 100644 --- a/docs/reference/cat/alias.asciidoc +++ b/docs/reference/cat/alias.asciidoc @@ -8,7 +8,7 @@ including filter and routing infos. Hidden setup for example: [source,js] -------------------------------------------------- -PUT test1 +PUT test1?include_type_name=true { "aliases": { "alias1": {}, diff --git a/docs/reference/cat/fielddata.asciidoc b/docs/reference/cat/fielddata.asciidoc index e308e9d91f790..45615090dd074 100644 --- a/docs/reference/cat/fielddata.asciidoc +++ b/docs/reference/cat/fielddata.asciidoc @@ -9,7 +9,7 @@ on every data node in the cluster. Hidden setup snippet to build an index with fielddata so our results are real: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/ccr/getting-started.asciidoc b/docs/reference/ccr/getting-started.asciidoc index 4ee189793de9c..a517587534ca8 100644 --- a/docs/reference/ccr/getting-started.asciidoc +++ b/docs/reference/ccr/getting-started.asciidoc @@ -167,7 +167,7 @@ In the following example, we will create a leader index in the remote cluster: [source,js] -------------------------------------------------- -PUT /server-metrics +PUT /server-metrics?include_type_name=true { "settings" : { "index" : { diff --git a/docs/reference/docs/get.asciidoc b/docs/reference/docs/get.asciidoc index 5271b976f9677..47fee04609501 100644 --- a/docs/reference/docs/get.asciidoc +++ b/docs/reference/docs/get.asciidoc @@ -107,7 +107,7 @@ Consider for instance the following mapping: [source,js] -------------------------------------------------- -PUT twitter +PUT twitter?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/docs/termvectors.asciidoc b/docs/reference/docs/termvectors.asciidoc index 9ef08a7e774c2..d6227b3c36202 100644 --- a/docs/reference/docs/termvectors.asciidoc +++ b/docs/reference/docs/termvectors.asciidoc @@ -125,7 +125,7 @@ First, we create an index that stores term vectors, payloads etc. : [source,js] -------------------------------------------------- -PUT /twitter/ +PUT /twitter?include_type_name=true { "mappings": { "_doc": { "properties": { diff --git a/docs/reference/docs/update-by-query.asciidoc b/docs/reference/docs/update-by-query.asciidoc index 0221b68ce6935..deef09dbbd792 100644 --- a/docs/reference/docs/update-by-query.asciidoc +++ b/docs/reference/docs/update-by-query.asciidoc @@ -637,7 +637,7 @@ added a mapping value to pick up more fields from the data: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { @@ -659,7 +659,7 @@ POST test/_doc?refresh "text": "words words", "flag": "foo" } -PUT test/_mapping/_doc <2> +PUT test/_mapping <2> { "properties": { "text": {"type": "text"}, diff --git a/docs/reference/how-to/disk-usage.asciidoc b/docs/reference/how-to/disk-usage.asciidoc index 999a1c27e86b3..d58233a7e01cb 100644 --- a/docs/reference/how-to/disk-usage.asciidoc +++ b/docs/reference/how-to/disk-usage.asciidoc @@ -12,7 +12,7 @@ filter on, you can safely disable indexing on this field in your [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { @@ -35,7 +35,7 @@ to not write norms to the index: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { @@ -58,7 +58,7 @@ Elasticsearch to not index positions: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { @@ -81,7 +81,7 @@ and scoring will assume that terms appear only once in every document. [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { @@ -115,7 +115,7 @@ fields as `keyword`: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/how-to/recipes/stemming.asciidoc b/docs/reference/how-to/recipes/stemming.asciidoc index 83f1379cd32a0..c0ec3f2a04c09 100644 --- a/docs/reference/how-to/recipes/stemming.asciidoc +++ b/docs/reference/how-to/recipes/stemming.asciidoc @@ -9,7 +9,7 @@ content indexed in two different ways: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/how-to/search-speed.asciidoc b/docs/reference/how-to/search-speed.asciidoc index f89eb4ed3cd39..4ab408be935ac 100644 --- a/docs/reference/how-to/search-speed.asciidoc +++ b/docs/reference/how-to/search-speed.asciidoc @@ -50,7 +50,7 @@ field. [source,js] -------------------------------------------------- -PUT movies +PUT movies?include_type_name=true { "mappings": { "_doc": { @@ -123,7 +123,7 @@ should be mapped as a <>: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { @@ -322,7 +322,7 @@ eagerly at refresh-time by configuring mappings as described below: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/ilm/apis/explain.asciidoc b/docs/reference/ilm/apis/explain.asciidoc index 66762ead9eb32..d23faf9f75d54 100644 --- a/docs/reference/ilm/apis/explain.asciidoc +++ b/docs/reference/ilm/apis/explain.asciidoc @@ -64,7 +64,7 @@ PUT _ilm/policy/my_policy } } -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy", diff --git a/docs/reference/ilm/apis/move-to-step.asciidoc b/docs/reference/ilm/apis/move-to-step.asciidoc index 57ea1a226ea40..207d5139298b7 100644 --- a/docs/reference/ilm/apis/move-to-step.asciidoc +++ b/docs/reference/ilm/apis/move-to-step.asciidoc @@ -72,7 +72,7 @@ PUT _ilm/policy/my_policy } } -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy" diff --git a/docs/reference/ilm/apis/remove-policy-from-index.asciidoc b/docs/reference/ilm/apis/remove-policy-from-index.asciidoc index 888d3f17eecac..81646cc135000 100644 --- a/docs/reference/ilm/apis/remove-policy-from-index.asciidoc +++ b/docs/reference/ilm/apis/remove-policy-from-index.asciidoc @@ -62,7 +62,7 @@ PUT _ilm/policy/my_policy } } -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy" diff --git a/docs/reference/ilm/error-handling.asciidoc b/docs/reference/ilm/error-handling.asciidoc index abe643255bf95..a671e33f2b1db 100644 --- a/docs/reference/ilm/error-handling.asciidoc +++ b/docs/reference/ilm/error-handling.asciidoc @@ -41,7 +41,7 @@ telling it to use the policy they have created: [source,js] -------------------------------------------------- -PUT /myindex +PUT /myindex?include_type_name=true { "settings": { "index.number_of_shards": 2, diff --git a/docs/reference/ilm/getting-started-ilm.asciidoc b/docs/reference/ilm/getting-started-ilm.asciidoc index f06c95f49c067..5c5e188a9d474 100644 --- a/docs/reference/ilm/getting-started-ilm.asciidoc +++ b/docs/reference/ilm/getting-started-ilm.asciidoc @@ -107,7 +107,7 @@ To begin, we will want to bootstrap our first index to write to. [source,js] ----------------------- -PUT datastream-000001 +PUT datastream-000001?include_type_name=true { "aliases": { "datastream": { diff --git a/docs/reference/ilm/policy-definitions.asciidoc b/docs/reference/ilm/policy-definitions.asciidoc index 1253c87b3943e..c4125496b38fb 100644 --- a/docs/reference/ilm/policy-definitions.asciidoc +++ b/docs/reference/ilm/policy-definitions.asciidoc @@ -353,7 +353,7 @@ index "my_index" must be the write index for the alias. For more information, re [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy", diff --git a/docs/reference/ilm/set-up-lifecycle-policy.asciidoc b/docs/reference/ilm/set-up-lifecycle-policy.asciidoc index 7af686238f334..417b4bf9ef875 100644 --- a/docs/reference/ilm/set-up-lifecycle-policy.asciidoc +++ b/docs/reference/ilm/set-up-lifecycle-policy.asciidoc @@ -73,7 +73,7 @@ initial index which will be managed by our policy: [source,js] ----------------------- -PUT test-000001 +PUT test-000001?include_type_name=true { "aliases": { "test-alias":{ @@ -96,7 +96,7 @@ request so {ilm} immediately starts managing the index: [source,js] ----------------------- -PUT test-index +PUT test-index?include_type_name=true { "settings": { "number_of_shards": 1, diff --git a/docs/reference/ilm/start-stop-ilm.asciidoc b/docs/reference/ilm/start-stop-ilm.asciidoc index e5366f028a9c7..1b5666f141096 100644 --- a/docs/reference/ilm/start-stop-ilm.asciidoc +++ b/docs/reference/ilm/start-stop-ilm.asciidoc @@ -39,7 +39,7 @@ PUT _ilm/policy/my_policy } } -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy" diff --git a/docs/reference/ilm/update-lifecycle-policy.asciidoc b/docs/reference/ilm/update-lifecycle-policy.asciidoc index 3e6627fdd3a7e..da3983d053c59 100644 --- a/docs/reference/ilm/update-lifecycle-policy.asciidoc +++ b/docs/reference/ilm/update-lifecycle-policy.asciidoc @@ -168,7 +168,7 @@ PUT _ilm/policy/my_executing_policy //// [source,js] ------------------------ -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_executing_policy" @@ -486,7 +486,7 @@ PUT _ilm/policy/my_other_policy } } -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.lifecycle.name": "my_policy" diff --git a/docs/reference/index-modules/allocation/prioritization.asciidoc b/docs/reference/index-modules/allocation/prioritization.asciidoc index 6693e6adb755e..f702a2f20f67c 100644 --- a/docs/reference/index-modules/allocation/prioritization.asciidoc +++ b/docs/reference/index-modules/allocation/prioritization.asciidoc @@ -19,14 +19,14 @@ PUT index_1 PUT index_2 -PUT index_3 +PUT index_3?include_type_name=true { "settings": { "index.priority": 10 } } -PUT index_4 +PUT index_4?include_type_name=true { "settings": { "index.priority": 5 diff --git a/docs/reference/index-modules/index-sorting.asciidoc b/docs/reference/index-modules/index-sorting.asciidoc index 30ea9f43c6d7c..1a0f8c65dc98b 100644 --- a/docs/reference/index-modules/index-sorting.asciidoc +++ b/docs/reference/index-modules/index-sorting.asciidoc @@ -14,7 +14,7 @@ For instance the following example shows how to define a sort on a single field: [source,js] -------------------------------------------------- -PUT twitter +PUT twitter?include_type_name=true { "settings" : { "index" : { @@ -42,7 +42,7 @@ It is also possible to sort the index by more than one field: [source,js] -------------------------------------------------- -PUT twitter +PUT twitter?include_type_name=true { "settings" : { "index" : { @@ -118,7 +118,7 @@ For example, let's say we have an index that contains events sorted by a timesta [source,js] -------------------------------------------------- -PUT events +PUT events?include_type_name=true { "settings" : { "index" : { diff --git a/docs/reference/index-modules/similarity.asciidoc b/docs/reference/index-modules/similarity.asciidoc index 06abaadd245ec..4d2404c3b52b0 100644 --- a/docs/reference/index-modules/similarity.asciidoc +++ b/docs/reference/index-modules/similarity.asciidoc @@ -20,7 +20,7 @@ settings. [source,js] -------------------------------------------------- -PUT /index +PUT /index?include_type_name=true { "settings" : { "index" : { @@ -44,7 +44,7 @@ Here we configure the DFRSimilarity so it can be referenced as [source,js] -------------------------------------------------- -PUT /index/_mapping/_doc +PUT /index/_mapping { "properties" : { "title" : { "type" : "text", "similarity" : "my_similarity" } @@ -200,7 +200,7 @@ TF-IDF: [source,js] -------------------------------------------------- -PUT /index +PUT /index?include_type_name=true { "settings": { "number_of_shards": 1, @@ -369,7 +369,7 @@ more efficient: [source,js] -------------------------------------------------- -PUT /index +PUT /index?include_type_name=true { "settings": { "number_of_shards": 1, @@ -537,7 +537,7 @@ it is <>: [source,js] -------------------------------------------------- -PUT /index +PUT /index?include_type_name=true { "settings": { "index": { diff --git a/docs/reference/index-modules/store.asciidoc b/docs/reference/index-modules/store.asciidoc index 8c1b99a42f2a6..1483a04868e81 100644 --- a/docs/reference/index-modules/store.asciidoc +++ b/docs/reference/index-modules/store.asciidoc @@ -24,7 +24,7 @@ creation time: [source,js] --------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "index.store.type": "niofs" @@ -114,7 +114,7 @@ or in the index settings at index creation time: [source,js] --------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "index.store.preload": ["nvd", "dvd"] diff --git a/docs/reference/indices/aliases.asciidoc b/docs/reference/indices/aliases.asciidoc index f4d4917528aa2..41cd8ce325e0d 100644 --- a/docs/reference/indices/aliases.asciidoc +++ b/docs/reference/indices/aliases.asciidoc @@ -142,7 +142,7 @@ exist in the mapping: [source,js] -------------------------------------------------- -PUT /test1 +PUT /test1?include_type_name=true { "mappings": { "_doc": { @@ -376,7 +376,7 @@ First create the index and add a mapping for the `user_id` field: [source,js] -------------------------------------------------- -PUT /users +PUT /users?include_type_name=true { "mappings" : { "_doc" : { @@ -416,7 +416,7 @@ Aliases can also be specified during <>: [source,js] -------------------------------------------------- -PUT /logs_20162801 +PUT /logs_20162801?include_type_name=true { "mappings" : { "_doc" : { diff --git a/docs/reference/indices/analyze.asciidoc b/docs/reference/indices/analyze.asciidoc index 0398e35962519..8570176282ef6 100644 --- a/docs/reference/indices/analyze.asciidoc +++ b/docs/reference/indices/analyze.asciidoc @@ -224,7 +224,7 @@ The following setting allows to limit the number of tokens that can be produced: [source,js] -------------------------------------------------- -PUT analyze_sample +PUT analyze_sample?include_type_name=true { "settings" : { "index.analyze.max_token_count" : 20000 diff --git a/docs/reference/indices/create-index.asciidoc b/docs/reference/indices/create-index.asciidoc index 7eac18c716a8e..54efcd9005ac5 100644 --- a/docs/reference/indices/create-index.asciidoc +++ b/docs/reference/indices/create-index.asciidoc @@ -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 for providing a mapping definition: [source,js] -------------------------------------------------- @@ -88,16 +88,18 @@ PUT test "number_of_shards" : 1 }, "mappings" : { - "_doc" : { - "properties" : { - "field1" : { "type" : "text" } - } + "properties" : { + "field1" : { "type" : "text" } } } } -------------------------------------------------- // CONSOLE +NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although specifying +types in requests is now deprecated, a type can still be provided if the request parameter +include_type_name is set. For more details, please see <>. + [float] [[create-index-aliases]] === Aliases @@ -177,28 +179,3 @@ PUT test?wait_for_active_shards=2 A detailed explanation of `wait_for_active_shards` and its possible values can be found <>. - -[float] -=== Skipping types - -Types are scheduled to be fully removed in Elasticsearch 8.0 and will not appear -in requests or responses anymore. You can opt in for this future behaviour by -setting `include_type_name=false` and putting mappings directly under `mappings` -in the index creation call. - -Here is an example: - -[source,js] --------------------------------------------------- -PUT test?include_type_name=false -{ - "mappings": { - "properties": { - "foo": { - "type": "keyword" - } - } - } -} --------------------------------------------------- -// CONSOLE diff --git a/docs/reference/indices/get-field-mapping.asciidoc b/docs/reference/indices/get-field-mapping.asciidoc index 644ffea458843..e857c6994a529 100644 --- a/docs/reference/indices/get-field-mapping.asciidoc +++ b/docs/reference/indices/get-field-mapping.asciidoc @@ -9,7 +9,7 @@ For example, consider the following mapping: [source,js] -------------------------------------------------- -PUT publications +PUT publications?include_type_name=true { "mappings": { "_doc": { @@ -35,7 +35,7 @@ The following returns the mapping of the field `title` only: [source,js] -------------------------------------------------- -GET publications/_mapping/_doc/field/title +GET publications/_mapping/field/title -------------------------------------------------- // CONSOLE @@ -46,29 +46,27 @@ For which the response is: { "publications": { "mappings": { - "_doc": { - "title": { - "full_name": "title", - "mapping": { - "title": { - "type": "text" - } - } - } - } - } + "title": { + "full_name": "title", + "mapping": { + "title": { + "type": "text" + } + } + } + } } } -------------------------------------------------- // TESTRESPONSE [float] -=== Multiple Indices, Types and Fields +=== Multiple Indices and Fields -The get field mapping API can be used to get the mapping of multiple fields from more than one index or type +The get field mapping API can be used to get the mapping of multiple fields from more than one index with a single call. General usage of the API follows the -following syntax: `host:port/{index}/{type}/_mapping/field/{field}` where -`{index}`, `{type}` and `{field}` can stand for comma-separated list of names or wild cards. To +following syntax: `host:port/{index}/_mapping/field/{field}` where +`{index}` and `{field}` can stand for comma-separated list of names or wild cards. To get mappings for all indices you can use `_all` for `{index}`. The following are some examples: @@ -76,9 +74,9 @@ following are some examples: -------------------------------------------------- GET /twitter,kimchy/_mapping/field/message -GET /_all/_mapping/_doc/field/message,user.id +GET /_all/_mapping/field/message,user.id -GET /_all/_mapping/_doc/field/*.id +GET /_all/_mapping/field/*.id -------------------------------------------------- // CONSOLE // TEST[setup:twitter] @@ -93,7 +91,7 @@ For instance to select the `id` of the `author` field, you must use its full nam [source,js] -------------------------------------------------- -GET publications/_mapping/_doc/field/author.id,abstract,name +GET publications/_mapping/field/author.id,abstract,name -------------------------------------------------- // CONSOLE @@ -104,25 +102,23 @@ returns: { "publications": { "mappings": { - "_doc": { - "author.id": { - "full_name": "author.id", - "mapping": { - "id": { - "type": "text" - } - } - }, - "abstract": { - "full_name": "abstract", - "mapping": { - "abstract": { - "type": "text" - } - } - } - } - } + "author.id": { + "full_name": "author.id", + "mapping": { + "id": { + "type": "text" + } + } + }, + "abstract": { + "full_name": "abstract", + "mapping": { + "abstract": { + "type": "text" + } + } + } + } } } -------------------------------------------------- @@ -132,7 +128,7 @@ The get field mapping API also supports wildcard notation. [source,js] -------------------------------------------------- -GET publications/_mapping/_doc/field/a* +GET publications/_mapping/field/a* -------------------------------------------------- // CONSOLE @@ -143,29 +139,27 @@ returns: { "publications": { "mappings": { - "_doc": { - "author.name": { - "full_name": "author.name", - "mapping": { - "name": { - "type": "text" - } + "author.name": { + "full_name": "author.name", + "mapping": { + "name": { + "type": "text" } - }, - "abstract": { - "full_name": "abstract", - "mapping": { - "abstract": { - "type": "text" - } + } + }, + "abstract": { + "full_name": "abstract", + "mapping": { + "abstract": { + "type": "text" } - }, - "author.id": { - "full_name": "author.id", - "mapping": { - "id": { - "type": "text" - } + } + }, + "author.id": { + "full_name": "author.id", + "mapping": { + "id": { + "type": "text" } } } diff --git a/docs/reference/indices/get-index.asciidoc b/docs/reference/indices/get-index.asciidoc index 8e254a576c11d..24abc33a6929a 100644 --- a/docs/reference/indices/get-index.asciidoc +++ b/docs/reference/indices/get-index.asciidoc @@ -16,62 +16,6 @@ alias or wildcard expression is required. The get index API can also be applied to more than one index, or on all indices by using `_all` or `*` as index. -[float] -=== Skipping types - -Types are scheduled to be fully removed in Elasticsearch 8.0 and will not appear -in requests or responses anymore. You can opt in for this future behaviour by -setting `include_type_name=false` in the request, which will return mappings -directly under `mappings` without keying by the type name. - -Here is an example: - -[source,js] --------------------------------------------------- -PUT test?include_type_name=false -{ - "mappings": { - "properties": { - "foo": { - "type": "keyword" - } - } - } -} - -GET test?include_type_name=false --------------------------------------------------- -// CONSOLE - -which returns - -[source,js] --------------------------------------------------- -{ - "test": { - "aliases": {}, - "mappings": { - "properties": { - "foo": { - "type": "keyword" - } - } - }, - "settings": { - "index": { - "creation_date": "1547028674905", - "number_of_shards": "1", - "number_of_replicas": "1", - "uuid": "u1YpkPqLSqGIn3kNAvY8cA", - "version": { - "created": ... - }, - "provided_name": "test" - } - } - } -} --------------------------------------------------- -// TESTRESPONSE[s/1547028674905/$body.test.settings.index.creation_date/] -// TESTRESPONSE[s/u1YpkPqLSqGIn3kNAvY8cA/$body.test.settings.index.uuid/] -// TESTRESPONSE[s/"created": \.\.\./"created": $body.test.settings.index.version.created/] +NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings +in responses no longer contain a type name by default, you can still request the old format +through the parameter include_type_name. For more details, please see <>. diff --git a/docs/reference/indices/get-mapping.asciidoc b/docs/reference/indices/get-mapping.asciidoc index 4bca1a9d09d35..fbd4a860b31e8 100644 --- a/docs/reference/indices/get-mapping.asciidoc +++ b/docs/reference/indices/get-mapping.asciidoc @@ -6,29 +6,31 @@ index/type. [source,js] -------------------------------------------------- -GET /twitter/_mapping/_doc +GET /twitter/_mapping -------------------------------------------------- // CONSOLE // TEST[setup:twitter] +NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings +in responses no longer contain a type name by default, you can still request the old format +through the parameter include_type_name. For more details, please see <>. + [float] -=== Multiple Indices and Types +=== Multiple Indices -The get mapping API can be used to get more than one index or type -mapping with a single call. General usage of the API follows the -following syntax: `host:port/{index}/_mapping/{type}` where both -`{index}` and `{type}` can accept a comma-separated list of names. To -get mappings for all indices you can use `_all` for `{index}`. The -following are some examples: +The get mapping API can be used to get more than one index with a +single call. General usage of the API follows the following syntax: +`host:port/{index}/_mapping` where `{index}` can accept a comma-separated +list of names. To get mappings for all indices you can use `_all` for `{index}`. +The following are some examples: [source,js] -------------------------------------------------- -GET /_mapping/_doc - -GET /_all/_mapping/_doc +GET /twitter,kimchy/_mapping -------------------------------------------------- // CONSOLE // TEST[setup:twitter] +// TEST[s/^/PUT kimchy\nPUT book\n/] If you want to get mappings of all indices and types then the following two examples are equivalent: @@ -41,48 +43,3 @@ GET /_mapping -------------------------------------------------- // CONSOLE // TEST[setup:twitter] - -[float] -=== Skipping types - -Types are scheduled to be fully removed in Elasticsearch 8.0 and will not appear -in requests or responses anymore. You can opt in for this future behaviour by -setting `include_type_name=false` in the request, which will return mappings -directly under `mappings` without keying by the type name. - -Here is an example: - -[source,js] --------------------------------------------------- -PUT test?include_type_name=false -{ - "mappings": { - "properties": { - "foo": { - "type": "keyword" - } - } - } -} - -GET test/_mappings?include_type_name=false --------------------------------------------------- -// CONSOLE - -which returns - -[source,js] --------------------------------------------------- -{ - "test": { - "mappings": { - "properties": { - "foo": { - "type": "keyword" - } - } - } - } -} --------------------------------------------------- -// TESTRESPONSE diff --git a/docs/reference/indices/put-mapping.asciidoc b/docs/reference/indices/put-mapping.asciidoc index 80dc52cd47d06..543497b8191dc 100644 --- a/docs/reference/indices/put-mapping.asciidoc +++ b/docs/reference/indices/put-mapping.asciidoc @@ -8,7 +8,7 @@ The PUT mapping API allows you to add fields to an existing index or to change s PUT twitter <1> {} -PUT twitter/_mapping/_doc <2> +PUT twitter/_mapping <2> { "properties": { "email": { @@ -18,11 +18,14 @@ PUT twitter/_mapping/_doc <2> } -------------------------------------------------- // CONSOLE -<1> <> called `twitter` without any type mapping. -<2> Uses the PUT mapping API to add a new field called `email` to the `_doc` mapping type. +<1> <> called `twitter` without any mapping. +<2> Uses the PUT mapping API to add a new field called `email`. -More information on how to define type mappings can be found in the -<> section. +More information on how to define mappings can be found in the <> section. + +NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although specifying +types in requests is now deprecated, a type can still be provided if the request parameter +include_type_name is set. For more details, please see <>. [float] === Multi-index @@ -37,7 +40,7 @@ PUT twitter-1 PUT twitter-2 # Update both mappings -PUT /twitter-1,twitter-2/_mapping/_doc <1> +PUT /twitter-1,twitter-2/_mapping <1> { "properties": { "user_name": { @@ -65,7 +68,7 @@ For example: [source,js] ----------------------------------- -PUT my_index <1> +PUT my_index?include_type_name=true <1> { "mappings": { "_doc": { @@ -85,7 +88,7 @@ PUT my_index <1> } } -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "properties": { "name": { @@ -109,54 +112,3 @@ PUT my_index/_mapping/_doc Each <> specifies whether or not its setting can be updated on an existing field. - -[float] -=== Skipping types - -Types are scheduled to be fully removed in Elasticsearch 8.0 and will not appear -in requests or responses anymore. You can opt in for this future behaviour by -setting `include_type_name=false`. - -NOTE: This should only be done on indices that have been created with -`include_type_name=false` or that used `_doc` as a type name. - -The Console script from the above section is equivalent to the below invocation: - -[source,js] ------------------------------------ -PUT my_index?include_type_name=false <1> -{ - "mappings": { - "properties": { - "name": { - "properties": { - "first": { - "type": "text" - } - } - }, - "user_id": { - "type": "keyword" - } - } - } -} - -PUT my_index/_mapping?include_type_name=false -{ - "properties": { - "name": { - "properties": { - "last": { <2> - "type": "text" - } - } - }, - "user_id": { - "type": "keyword", - "ignore_above": 100 <3> - } - } -} ------------------------------------ -// CONSOLE diff --git a/docs/reference/indices/recovery.asciidoc b/docs/reference/indices/recovery.asciidoc index 0929b36e7742d..975beacc02cb2 100644 --- a/docs/reference/indices/recovery.asciidoc +++ b/docs/reference/indices/recovery.asciidoc @@ -24,7 +24,7 @@ indices recovery result. [source,js] -------------------------------------------------- # create the index -PUT index1 +PUT index1?include_type_name=true {"settings": {"index.number_of_shards": 1}} # create the repository diff --git a/docs/reference/indices/rollover-index.asciidoc b/docs/reference/indices/rollover-index.asciidoc index 1730c95e0dd24..d53fd46551983 100644 --- a/docs/reference/indices/rollover-index.asciidoc +++ b/docs/reference/indices/rollover-index.asciidoc @@ -187,7 +187,7 @@ override any values set in matching index templates. For example, the following [source,js] -------------------------------------------------- -PUT /logs-000001 +PUT /logs-000001?include_type_name=true { "aliases": { "logs_write": {} @@ -216,7 +216,7 @@ checked without performing the actual rollover: [source,js] -------------------------------------------------- -PUT /logs-000001 +PUT /logs-000001?include_type_name=true { "aliases": { "logs_write": {} @@ -258,7 +258,7 @@ Look at the behavior of the aliases in the following example where `is_write_ind [source,js] -------------------------------------------------- -PUT my_logs_index-000001 +PUT my_logs_index-000001?include_type_name=true { "aliases": { "logs": { "is_write_index": true } <1> diff --git a/docs/reference/indices/split-index.asciidoc b/docs/reference/indices/split-index.asciidoc index ade0a8075d582..465d7603a603d 100644 --- a/docs/reference/indices/split-index.asciidoc +++ b/docs/reference/indices/split-index.asciidoc @@ -86,7 +86,7 @@ Create a new index: [source,js] -------------------------------------------------- -PUT my_source_index +PUT my_source_index?include_type_name=true { "settings": { "index.number_of_shards" : 1 diff --git a/docs/reference/indices/templates.asciidoc b/docs/reference/indices/templates.asciidoc index 02c0b7a4cbe82..c9ac3e61c29b5 100644 --- a/docs/reference/indices/templates.asciidoc +++ b/docs/reference/indices/templates.asciidoc @@ -23,18 +23,16 @@ PUT _template/template_1 "number_of_shards": 1 }, "mappings": { - "_doc": { - "_source": { - "enabled": false + "_source": { + "enabled": false + }, + "properties": { + "host_name": { + "type": "keyword" }, - "properties": { - "host_name": { - "type": "keyword" - }, - "created_at": { - "type": "date", - "format": "EEE MMM dd HH:mm:ss Z yyyy" - } + "created_at": { + "type": "date", + "format": "EEE MMM dd HH:mm:ss Z yyyy" } } } @@ -137,6 +135,10 @@ The HTTP status code indicates if the template with the given name exists or not. Status code `200` means it exists and `404` means it does not. +NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings +no longer contain a type name by default, you can still use the old format by setting +the parameter include_type_name. For more details, please see <>. + [float] [[multiple-templates]] === Multiple Templates Matching @@ -157,9 +159,7 @@ PUT /_template/template_1 "number_of_shards" : 1 }, "mappings" : { - "_doc" : { - "_source" : { "enabled" : false } - } + "_source" : { "enabled" : false } } } @@ -171,9 +171,7 @@ PUT /_template/template_2 "number_of_shards" : 1 }, "mappings" : { - "_doc" : { - "_source" : { "enabled" : true } - } + "_source" : { "enabled" : true } } } -------------------------------------------------- diff --git a/docs/reference/ingest/processors/geoip.asciidoc b/docs/reference/ingest/processors/geoip.asciidoc index 7b80422c3aa2f..f9f902395c4b2 100644 --- a/docs/reference/ingest/processors/geoip.asciidoc +++ b/docs/reference/ingest/processors/geoip.asciidoc @@ -196,7 +196,7 @@ You can use the following mapping for the example index above: [source,js] -------------------------------------------------- -PUT my_ip_locations +PUT my_ip_locations?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping.asciidoc b/docs/reference/mapping.asciidoc index 926d2c2ecb5dc..d7a8864431710 100644 --- a/docs/reference/mapping.asciidoc +++ b/docs/reference/mapping.asciidoc @@ -137,7 +137,7 @@ A mapping could be specified when creating an index, as follows: [source,js] --------------------------------------- -PUT my_index <1> +PUT my_index?include_type_name=true <1> { "mappings": { "_doc": { <2> diff --git a/docs/reference/mapping/dynamic/field-mapping.asciidoc b/docs/reference/mapping/dynamic/field-mapping.asciidoc index 5e0cc7e0bd6d0..c7a96a33473e5 100644 --- a/docs/reference/mapping/dynamic/field-mapping.asciidoc +++ b/docs/reference/mapping/dynamic/field-mapping.asciidoc @@ -66,7 +66,7 @@ Dynamic date detection can be disabled by setting `date_detection` to `false`: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -91,7 +91,7 @@ own <>: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -119,7 +119,7 @@ correct solution is to map these fields explicitly, but numeric detection [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/dynamic/templates.asciidoc b/docs/reference/mapping/dynamic/templates.asciidoc index 3ad7da6e17744..f10a9d3475b66 100644 --- a/docs/reference/mapping/dynamic/templates.asciidoc +++ b/docs/reference/mapping/dynamic/templates.asciidoc @@ -69,7 +69,7 @@ could use the following template: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -125,7 +125,7 @@ fields: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -181,7 +181,7 @@ top-level `full_name` field, except for the `middle` field: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -222,7 +222,7 @@ field, and disables <> for all non-string fields: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -276,7 +276,7 @@ you will have to search on the exact same value that was indexed. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -306,7 +306,7 @@ before 5.0): [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -334,7 +334,7 @@ disable the storage of these scoring factors in the index and save some space. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -375,7 +375,7 @@ maybe gain some indexing speed: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/fields/field-names-field.asciidoc b/docs/reference/mapping/fields/field-names-field.asciidoc index 6cba81b54f1ba..acc401cf0ec78 100644 --- a/docs/reference/mapping/fields/field-names-field.asciidoc +++ b/docs/reference/mapping/fields/field-names-field.asciidoc @@ -21,7 +21,7 @@ execute `exists` queries using those fields you might want to disable [source,js] -------------------------------------------------- -PUT tweets +PUT tweets?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/fields/meta-field.asciidoc b/docs/reference/mapping/fields/meta-field.asciidoc index 2e6c148b18f9d..bdfa7d94d2c0c 100644 --- a/docs/reference/mapping/fields/meta-field.asciidoc +++ b/docs/reference/mapping/fields/meta-field.asciidoc @@ -7,7 +7,7 @@ metadata, such as the class that a document belongs to: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -31,7 +31,7 @@ The `_meta` field can be updated on an existing type using the [source,js] -------------------------------------------------- -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "_meta": { "class": "MyApp2::User3", diff --git a/docs/reference/mapping/fields/routing-field.asciidoc b/docs/reference/mapping/fields/routing-field.asciidoc index 07fbb80bcb664..ca823b2430b12 100644 --- a/docs/reference/mapping/fields/routing-field.asciidoc +++ b/docs/reference/mapping/fields/routing-field.asciidoc @@ -79,7 +79,7 @@ custom `routing` value required for all CRUD operations: [source,js] ------------------------------ -PUT my_index2 +PUT my_index2?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/fields/source-field.asciidoc b/docs/reference/mapping/fields/source-field.asciidoc index e872d31e56326..8f7943ebc0ff6 100644 --- a/docs/reference/mapping/fields/source-field.asciidoc +++ b/docs/reference/mapping/fields/source-field.asciidoc @@ -13,7 +13,7 @@ within the index. For this reason, it can be disabled as follows: [source,js] -------------------------------------------------- -PUT tweets +PUT tweets?include_type_name=true { "mappings": { "_doc": { @@ -85,7 +85,7 @@ as follows: [source,js] -------------------------------------------------- -PUT logs +PUT logs?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/analyzer.asciidoc b/docs/reference/mapping/params/analyzer.asciidoc index c885b99ab6313..43cfb7082796f 100644 --- a/docs/reference/mapping/params/analyzer.asciidoc +++ b/docs/reference/mapping/params/analyzer.asciidoc @@ -41,7 +41,7 @@ in the field mapping, as follows: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "mappings": { "_doc": { @@ -93,7 +93,7 @@ To disable stop words for phrases a field utilising three analyzer settings will [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings":{ "analysis":{ diff --git a/docs/reference/mapping/params/boost.asciidoc b/docs/reference/mapping/params/boost.asciidoc index f2a5e48483c70..c6f6d104c0ca0 100644 --- a/docs/reference/mapping/params/boost.asciidoc +++ b/docs/reference/mapping/params/boost.asciidoc @@ -6,7 +6,7 @@ Individual fields can be _boosted_ automatically -- count more towards the relev [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/coerce.asciidoc b/docs/reference/mapping/params/coerce.asciidoc index fff0d27b6ff27..dbb7ca84ba6fd 100644 --- a/docs/reference/mapping/params/coerce.asciidoc +++ b/docs/reference/mapping/params/coerce.asciidoc @@ -17,7 +17,7 @@ For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -61,7 +61,7 @@ coercion globally across all mapping types: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.mapping.coerce": false diff --git a/docs/reference/mapping/params/copy-to.asciidoc b/docs/reference/mapping/params/copy-to.asciidoc index 6a1aef62bc391..d56258aa73324 100644 --- a/docs/reference/mapping/params/copy-to.asciidoc +++ b/docs/reference/mapping/params/copy-to.asciidoc @@ -8,7 +8,7 @@ the `full_name` field as follows: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/doc-values.asciidoc b/docs/reference/mapping/params/doc-values.asciidoc index 88bc944e3c589..74efc1bbbfabd 100644 --- a/docs/reference/mapping/params/doc-values.asciidoc +++ b/docs/reference/mapping/params/doc-values.asciidoc @@ -23,7 +23,7 @@ value from a script, you can disable doc values in order to save disk space: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/dynamic.asciidoc b/docs/reference/mapping/params/dynamic.asciidoc index 63303abdefd75..f7159724f48f4 100644 --- a/docs/reference/mapping/params/dynamic.asciidoc +++ b/docs/reference/mapping/params/dynamic.asciidoc @@ -58,7 +58,7 @@ object or from the mapping type. For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/eager-global-ordinals.asciidoc b/docs/reference/mapping/params/eager-global-ordinals.asciidoc index 1b4cee65e6173..8973be951129c 100644 --- a/docs/reference/mapping/params/eager-global-ordinals.asciidoc +++ b/docs/reference/mapping/params/eager-global-ordinals.asciidoc @@ -36,7 +36,7 @@ aggregations: [source,js] ------------ -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "properties": { "tags": { @@ -59,7 +59,7 @@ time: [source,js] ------------ -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "properties": { "tags": { diff --git a/docs/reference/mapping/params/enabled.asciidoc b/docs/reference/mapping/params/enabled.asciidoc index 111d431cd25a1..fbcd25c716bbf 100644 --- a/docs/reference/mapping/params/enabled.asciidoc +++ b/docs/reference/mapping/params/enabled.asciidoc @@ -15,7 +15,7 @@ in any other way: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -63,7 +63,7 @@ retrieved, but none of its contents are indexed in any way: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { <1> diff --git a/docs/reference/mapping/params/fielddata.asciidoc b/docs/reference/mapping/params/fielddata.asciidoc index ff959b98b6e7f..eee7463c6400c 100644 --- a/docs/reference/mapping/params/fielddata.asciidoc +++ b/docs/reference/mapping/params/fielddata.asciidoc @@ -55,7 +55,7 @@ enabled for aggregations, as follows: [source,js] --------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -84,7 +84,7 @@ You can enable fielddata on an existing `text` field using the [source,js] ----------------------------------- -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "properties": { "my_field": { <1> @@ -118,7 +118,7 @@ number of docs that the segment should contain with `min_segment_size`: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/format.asciidoc b/docs/reference/mapping/params/format.asciidoc index 120233a8f0fdd..641433685d3a2 100644 --- a/docs/reference/mapping/params/format.asciidoc +++ b/docs/reference/mapping/params/format.asciidoc @@ -11,7 +11,7 @@ Besides the <>, your own [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/ignore-above.asciidoc b/docs/reference/mapping/params/ignore-above.asciidoc index fe28e77cd6322..19c275dac5d01 100644 --- a/docs/reference/mapping/params/ignore-above.asciidoc +++ b/docs/reference/mapping/params/ignore-above.asciidoc @@ -8,7 +8,7 @@ NOTE: All strings/array elements will still be present in the `_source` field, i [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/ignore-malformed.asciidoc b/docs/reference/mapping/params/ignore-malformed.asciidoc index be0bdfe4ffaf8..84a53515d9ebe 100644 --- a/docs/reference/mapping/params/ignore-malformed.asciidoc +++ b/docs/reference/mapping/params/ignore-malformed.asciidoc @@ -14,7 +14,7 @@ For example: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -61,7 +61,7 @@ allow to ignore malformed content globally across all mapping types. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "index.mapping.ignore_malformed": true <1> diff --git a/docs/reference/mapping/params/index-options.asciidoc b/docs/reference/mapping/params/index-options.asciidoc index 9bbdd017e0249..cda680399dde2 100644 --- a/docs/reference/mapping/params/index-options.asciidoc +++ b/docs/reference/mapping/params/index-options.asciidoc @@ -35,7 +35,7 @@ all other fields use `docs` as the default. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/index-prefixes.asciidoc b/docs/reference/mapping/params/index-prefixes.asciidoc index 203e063bbfb6f..baca8606f5c03 100644 --- a/docs/reference/mapping/params/index-prefixes.asciidoc +++ b/docs/reference/mapping/params/index-prefixes.asciidoc @@ -19,7 +19,7 @@ This example creates a text field using the default prefix length settings: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -42,7 +42,7 @@ This example uses custom prefix length settings: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/multi-fields.asciidoc b/docs/reference/mapping/params/multi-fields.asciidoc index 2f973a3f62b3a..e4bdb04506d92 100644 --- a/docs/reference/mapping/params/multi-fields.asciidoc +++ b/docs/reference/mapping/params/multi-fields.asciidoc @@ -8,7 +8,7 @@ search, and as a `keyword` field for sorting or aggregations: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -76,7 +76,7 @@ which stems words into their root form: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/normalizer.asciidoc b/docs/reference/mapping/params/normalizer.asciidoc index bfd24381753f7..79ba39e194726 100644 --- a/docs/reference/mapping/params/normalizer.asciidoc +++ b/docs/reference/mapping/params/normalizer.asciidoc @@ -12,7 +12,7 @@ such as the <> query. [source,js] -------------------------------- -PUT index +PUT index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/mapping/params/norms.asciidoc b/docs/reference/mapping/params/norms.asciidoc index 842f0af64b537..8a7be4baef8c5 100644 --- a/docs/reference/mapping/params/norms.asciidoc +++ b/docs/reference/mapping/params/norms.asciidoc @@ -20,7 +20,7 @@ Norms can be disabled (but not reenabled) after the fact, using the [source,js] ------------ -PUT my_index/_mapping/_doc +PUT my_index/_mapping { "properties": { "title": { diff --git a/docs/reference/mapping/params/null-value.asciidoc b/docs/reference/mapping/params/null-value.asciidoc index f85724e66d0ae..b2f46a2c7cef3 100644 --- a/docs/reference/mapping/params/null-value.asciidoc +++ b/docs/reference/mapping/params/null-value.asciidoc @@ -10,7 +10,7 @@ the specified value so that it can be indexed and searched. For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/position-increment-gap.asciidoc b/docs/reference/mapping/params/position-increment-gap.asciidoc index c002d5a861aa8..ae6cc85865709 100644 --- a/docs/reference/mapping/params/position-increment-gap.asciidoc +++ b/docs/reference/mapping/params/position-increment-gap.asciidoc @@ -51,7 +51,7 @@ The `position_increment_gap` can be specified in the mapping. For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/properties.asciidoc b/docs/reference/mapping/params/properties.asciidoc index e50c0b3ac777f..2efef0abf3cdc 100644 --- a/docs/reference/mapping/params/properties.asciidoc +++ b/docs/reference/mapping/params/properties.asciidoc @@ -15,7 +15,7 @@ field, and a `nested` field: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { <1> diff --git a/docs/reference/mapping/params/search-analyzer.asciidoc b/docs/reference/mapping/params/search-analyzer.asciidoc index 1a67dfab63182..eb483a3af384f 100644 --- a/docs/reference/mapping/params/search-analyzer.asciidoc +++ b/docs/reference/mapping/params/search-analyzer.asciidoc @@ -14,7 +14,7 @@ this can be overridden with the `search_analyzer` setting: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/mapping/params/similarity.asciidoc b/docs/reference/mapping/params/similarity.asciidoc index a0be0fb3ccbeb..9e6e4e0877830 100644 --- a/docs/reference/mapping/params/similarity.asciidoc +++ b/docs/reference/mapping/params/similarity.asciidoc @@ -36,7 +36,7 @@ as follows: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/store.asciidoc b/docs/reference/mapping/params/store.asciidoc index 56c62385b59c8..186666ef5dd73 100644 --- a/docs/reference/mapping/params/store.asciidoc +++ b/docs/reference/mapping/params/store.asciidoc @@ -18,7 +18,7 @@ to extract those fields from a large `_source` field: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/params/term-vector.asciidoc b/docs/reference/mapping/params/term-vector.asciidoc index c71c23f8a4881..491a002f3d612 100644 --- a/docs/reference/mapping/params/term-vector.asciidoc +++ b/docs/reference/mapping/params/term-vector.asciidoc @@ -29,7 +29,7 @@ index. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/removal_of_types.asciidoc b/docs/reference/mapping/removal_of_types.asciidoc index 75690875e0eb8..251025c1ba24c 100644 --- a/docs/reference/mapping/removal_of_types.asciidoc +++ b/docs/reference/mapping/removal_of_types.asciidoc @@ -112,7 +112,7 @@ have looked something like this: [source,js] ---- -PUT twitter +PUT twitter?include_type_name=true { "mappings": { "user": { @@ -161,7 +161,7 @@ You could achieve the same thing by adding a custom `type` field as follows: [source,js] ---- -PUT twitter +PUT twitter?include_type_name=true { "mappings": { "_doc": { @@ -299,7 +299,7 @@ This first example splits our `twitter` index into a `tweets` index and a [source,js] ---- -PUT users +PUT users?include_type_name=true { "settings": { "index.mapping.single_type": true @@ -321,7 +321,7 @@ PUT users } } -PUT tweets +PUT tweets?include_type_name=true { "settings": { "index.mapping.single_type": true @@ -376,7 +376,7 @@ documents of different types which have conflicting IDs: [source,js] ---- -PUT new_twitter +PUT new_twitter?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/alias.asciidoc b/docs/reference/mapping/types/alias.asciidoc index b4243d80e6d08..75a2b65e5c110 100644 --- a/docs/reference/mapping/types/alias.asciidoc +++ b/docs/reference/mapping/types/alias.asciidoc @@ -7,7 +7,7 @@ and selected other APIs like <>. [source,js] -------------------------------- -PUT trips +PUT trips?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/binary.asciidoc b/docs/reference/mapping/types/binary.asciidoc index 9b7b032d0abf4..ebd50802b8d84 100644 --- a/docs/reference/mapping/types/binary.asciidoc +++ b/docs/reference/mapping/types/binary.asciidoc @@ -7,7 +7,7 @@ stored by default and is not searchable: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/boolean.asciidoc b/docs/reference/mapping/types/boolean.asciidoc index 4ae350412bece..3a92ae23e2fd9 100644 --- a/docs/reference/mapping/types/boolean.asciidoc +++ b/docs/reference/mapping/types/boolean.asciidoc @@ -17,7 +17,7 @@ For example: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/date.asciidoc b/docs/reference/mapping/types/date.asciidoc index 1beb64083b8c8..03024d1383945 100644 --- a/docs/reference/mapping/types/date.asciidoc +++ b/docs/reference/mapping/types/date.asciidoc @@ -30,7 +30,7 @@ For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -74,7 +74,7 @@ into a string. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/dense-vector.asciidoc b/docs/reference/mapping/types/dense-vector.asciidoc index f948968ed3b5c..b12e9e120a479 100644 --- a/docs/reference/mapping/types/dense-vector.asciidoc +++ b/docs/reference/mapping/types/dense-vector.asciidoc @@ -17,7 +17,7 @@ You index a dense vector as an array of floats. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/feature-vector.asciidoc b/docs/reference/mapping/types/feature-vector.asciidoc index 2ce3c017fe3e5..25358ab9ec3a6 100644 --- a/docs/reference/mapping/types/feature-vector.asciidoc +++ b/docs/reference/mapping/types/feature-vector.asciidoc @@ -11,7 +11,7 @@ one field to the mappings for each of them. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/feature.asciidoc b/docs/reference/mapping/types/feature.asciidoc index 3b5e78d5fb46b..76eada86c59e5 100644 --- a/docs/reference/mapping/types/feature.asciidoc +++ b/docs/reference/mapping/types/feature.asciidoc @@ -6,7 +6,7 @@ documents in queries with a <> query. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/geo-point.asciidoc b/docs/reference/mapping/types/geo-point.asciidoc index 97f2ddb52825b..752e611db811f 100644 --- a/docs/reference/mapping/types/geo-point.asciidoc +++ b/docs/reference/mapping/types/geo-point.asciidoc @@ -15,7 +15,7 @@ There are four ways that a geo-point may be specified, as demonstrated below: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/geo-shape.asciidoc b/docs/reference/mapping/types/geo-shape.asciidoc index 92ee2d1065100..11ba1c55cb228 100644 --- a/docs/reference/mapping/types/geo-shape.asciidoc +++ b/docs/reference/mapping/types/geo-shape.asciidoc @@ -198,7 +198,7 @@ the cell right next to it -- even though the shape is very close to the point. [source,js] -------------------------------------------------- -PUT /example +PUT /example?include_type_name=true { "mappings": { "doc": { diff --git a/docs/reference/mapping/types/ip.asciidoc b/docs/reference/mapping/types/ip.asciidoc index 695cd1c626bc3..6206df61ac3b6 100644 --- a/docs/reference/mapping/types/ip.asciidoc +++ b/docs/reference/mapping/types/ip.asciidoc @@ -6,7 +6,7 @@ https://en.wikipedia.org/wiki/IPv6[IPv6] addresses. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/keyword.asciidoc b/docs/reference/mapping/types/keyword.asciidoc index 09d540feed19b..e9e913be3a6d0 100644 --- a/docs/reference/mapping/types/keyword.asciidoc +++ b/docs/reference/mapping/types/keyword.asciidoc @@ -15,7 +15,7 @@ Below is an example of a mapping for a keyword field: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/nested.asciidoc b/docs/reference/mapping/types/nested.asciidoc index 238e26bf3375b..4681897575189 100644 --- a/docs/reference/mapping/types/nested.asciidoc +++ b/docs/reference/mapping/types/nested.asciidoc @@ -75,7 +75,7 @@ queried independently of the others, with the < diff --git a/docs/reference/mapping/types/parent-join.asciidoc b/docs/reference/mapping/types/parent-join.asciidoc index ea2e1f719a7ca..dacef7c4bc7cb 100644 --- a/docs/reference/mapping/types/parent-join.asciidoc +++ b/docs/reference/mapping/types/parent-join.asciidoc @@ -9,7 +9,7 @@ A parent/child relation can be defined as follows: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -319,7 +319,7 @@ make sense to disable eager loading: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -358,7 +358,7 @@ It is also possible to define multiple children for a single parent: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -388,7 +388,7 @@ Multiple levels of parent/child: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/percolator.asciidoc b/docs/reference/mapping/types/percolator.asciidoc index c6d31d942b979..7324826eb44ef 100644 --- a/docs/reference/mapping/types/percolator.asciidoc +++ b/docs/reference/mapping/types/percolator.asciidoc @@ -15,7 +15,7 @@ If the following mapping configures the `percolator` field type for the [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { @@ -69,7 +69,7 @@ Lets take a look at the following index with a percolator field type: [source,js] -------------------------------------------------- -PUT index +PUT index?include_type_name=true { "mappings": { "_doc" : { @@ -117,7 +117,7 @@ to read your queries you need to reindex your queries into a new index on the cu [source,js] -------------------------------------------------- -PUT new_index +PUT new_index?include_type_name=true { "mappings": { "_doc" : { @@ -269,7 +269,7 @@ with these settings and mapping: [source,js] -------------------------------------------------- -PUT /test_index +PUT /test_index?include_type_name=true { "settings": { "analysis": { @@ -442,7 +442,7 @@ Creating an index with custom analysis settings: [source,js] -------------------------------------------------- -PUT my_queries1 +PUT my_queries1?include_type_name=true { "settings": { "analysis": { @@ -595,7 +595,7 @@ before the `edge_ngram` token filter. [source,js] -------------------------------------------------- -PUT my_queries2 +PUT my_queries2?include_type_name=true { "settings": { "analysis": { diff --git a/docs/reference/mapping/types/range.asciidoc b/docs/reference/mapping/types/range.asciidoc index fcf13ed446b0a..630458b4866e5 100644 --- a/docs/reference/mapping/types/range.asciidoc +++ b/docs/reference/mapping/types/range.asciidoc @@ -16,7 +16,7 @@ Below is an example of configuring a mapping with various range fields followed [source,js] -------------------------------------------------- -PUT range_index +PUT range_index?include_type_name=true { "settings": { "number_of_shards": 2 @@ -184,7 +184,7 @@ https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation[CIDR] [source,js] -------------------------------------------------- -PUT range_index/_mapping/_doc +PUT range_index/_mapping { "properties": { "ip_whitelist": { diff --git a/docs/reference/mapping/types/sparse-vector.asciidoc b/docs/reference/mapping/types/sparse-vector.asciidoc index 1ef02d4738ce7..df374e857ba6a 100644 --- a/docs/reference/mapping/types/sparse-vector.asciidoc +++ b/docs/reference/mapping/types/sparse-vector.asciidoc @@ -20,7 +20,7 @@ Dimensions don't need to be in order. [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/text.asciidoc b/docs/reference/mapping/types/text.asciidoc index dd7e6cbbacfff..1b3c0a0eaf112 100644 --- a/docs/reference/mapping/types/text.asciidoc +++ b/docs/reference/mapping/types/text.asciidoc @@ -17,7 +17,7 @@ Below is an example of a mapping for a text field: [source,js] -------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/mapping/types/token-count.asciidoc b/docs/reference/mapping/types/token-count.asciidoc index 6f3295fab5ebb..469583abf1bcd 100644 --- a/docs/reference/mapping/types/token-count.asciidoc +++ b/docs/reference/mapping/types/token-count.asciidoc @@ -9,7 +9,7 @@ For instance: [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/ml/transforms.asciidoc b/docs/reference/ml/transforms.asciidoc index 6fc67fa7c4e4b..02dd4d5469cfd 100644 --- a/docs/reference/ml/transforms.asciidoc +++ b/docs/reference/ml/transforms.asciidoc @@ -26,7 +26,7 @@ subsequent examples: [source,js] ---------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "mappings":{ "_doc":{ diff --git a/docs/reference/modules/indices/request_cache.asciidoc b/docs/reference/modules/indices/request_cache.asciidoc index fc04c5e9c63f6..d13c108589836 100644 --- a/docs/reference/modules/indices/request_cache.asciidoc +++ b/docs/reference/modules/indices/request_cache.asciidoc @@ -55,7 +55,7 @@ index as follows: [source,js] ----------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "settings": { "index.requests.cache.enable": false diff --git a/docs/reference/modules/scripting/fields.asciidoc b/docs/reference/modules/scripting/fields.asciidoc index 408707207f010..d615038baa25f 100644 --- a/docs/reference/modules/scripting/fields.asciidoc +++ b/docs/reference/modules/scripting/fields.asciidoc @@ -172,7 +172,7 @@ For instance: [source,js] ------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/exists-query.asciidoc b/docs/reference/query-dsl/exists-query.asciidoc index 3e0fd71cd58b0..16828c3751a39 100644 --- a/docs/reference/query-dsl/exists-query.asciidoc +++ b/docs/reference/query-dsl/exists-query.asciidoc @@ -52,7 +52,7 @@ instance, if the `user` field were mapped as follows: [source,js] -------------------------------------------------- -PUT /example +PUT /example?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/feature-query.asciidoc b/docs/reference/query-dsl/feature-query.asciidoc index 5d1683854375b..c261133cff412 100644 --- a/docs/reference/query-dsl/feature-query.asciidoc +++ b/docs/reference/query-dsl/feature-query.asciidoc @@ -27,7 +27,7 @@ based or `pagerank`, `url_length` and the `sports` topic. [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc index fdf5ca5de16e5..8c2b25ea0ee7a 100644 --- a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc +++ b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc @@ -6,7 +6,7 @@ bounding box. Assuming the following indexed document: [source,js] -------------------------------------------------- -PUT /my_locations +PUT /my_locations?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/geo-distance-query.asciidoc b/docs/reference/query-dsl/geo-distance-query.asciidoc index 2bf24c942cbcc..da1f99f834d67 100644 --- a/docs/reference/query-dsl/geo-distance-query.asciidoc +++ b/docs/reference/query-dsl/geo-distance-query.asciidoc @@ -7,7 +7,7 @@ document: [source,js] -------------------------------------------------- -PUT /my_locations +PUT /my_locations?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/geo-shape-query.asciidoc b/docs/reference/query-dsl/geo-shape-query.asciidoc index 059d0db14b51a..4121ebfc45edd 100644 --- a/docs/reference/query-dsl/geo-shape-query.asciidoc +++ b/docs/reference/query-dsl/geo-shape-query.asciidoc @@ -24,7 +24,7 @@ Given the following index: [source,js] -------------------------------------------------- -PUT /example +PUT /example?include_type_name=true { "mappings": { "_doc": { @@ -99,7 +99,7 @@ shape: [source,js] -------------------------------------------------- -PUT /shapes +PUT /shapes?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/mlt-query.asciidoc b/docs/reference/query-dsl/mlt-query.asciidoc index 64a2a6052df71..3d8b08b8ff44e 100644 --- a/docs/reference/query-dsl/mlt-query.asciidoc +++ b/docs/reference/query-dsl/mlt-query.asciidoc @@ -119,7 +119,7 @@ default, but there will be no speed up on analysis for these fields. [source,js] -------------------------------------------------- -PUT /imdb +PUT /imdb?include_type_name=true { "mappings": { "movies": { diff --git a/docs/reference/query-dsl/nested-query.asciidoc b/docs/reference/query-dsl/nested-query.asciidoc index 9c6276a0565a2..f75348ca976ec 100644 --- a/docs/reference/query-dsl/nested-query.asciidoc +++ b/docs/reference/query-dsl/nested-query.asciidoc @@ -10,7 +10,7 @@ will work with: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "mappings": { "_doc" : { diff --git a/docs/reference/query-dsl/parent-id-query.asciidoc b/docs/reference/query-dsl/parent-id-query.asciidoc index aa86923541254..ff306238ddea0 100644 --- a/docs/reference/query-dsl/parent-id-query.asciidoc +++ b/docs/reference/query-dsl/parent-id-query.asciidoc @@ -6,7 +6,7 @@ Given the following mapping definition: [source,js] -------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/percolate-query.asciidoc b/docs/reference/query-dsl/percolate-query.asciidoc index a343b4dbb89cb..9ae6dd802137c 100644 --- a/docs/reference/query-dsl/percolate-query.asciidoc +++ b/docs/reference/query-dsl/percolate-query.asciidoc @@ -13,7 +13,7 @@ Create an index with two fields: [source,js] -------------------------------------------------- -PUT /my-index +PUT /my-index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/term-query.asciidoc b/docs/reference/query-dsl/term-query.asciidoc index f1224f33ca7d4..26dd6ee492f21 100644 --- a/docs/reference/query-dsl/term-query.asciidoc +++ b/docs/reference/query-dsl/term-query.asciidoc @@ -87,7 +87,7 @@ To demonstrate, try out the example below. First, create an index, specifying t [source,js] -------------------------------------------------- -PUT my_index +PUT my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/query-dsl/terms-set-query.asciidoc b/docs/reference/query-dsl/terms-set-query.asciidoc index fa879bb068d34..5c0e00ce360fa 100644 --- a/docs/reference/query-dsl/terms-set-query.asciidoc +++ b/docs/reference/query-dsl/terms-set-query.asciidoc @@ -12,7 +12,7 @@ be a number field: [source,js] -------------------------------------------------- -PUT /my-index +PUT /my-index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/search/request/highlighters-internal.asciidoc b/docs/reference/search/request/highlighters-internal.asciidoc index 651cdf917ced0..aa3377bdccf61 100644 --- a/docs/reference/search/request/highlighters-internal.asciidoc +++ b/docs/reference/search/request/highlighters-internal.asciidoc @@ -87,7 +87,7 @@ using `english` analyzer, and will be indexed without offsets or term vectors. [source,js] -------------------------------------------------- -PUT test_index +PUT test_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/search/request/highlighting.asciidoc b/docs/reference/search/request/highlighting.asciidoc index e798fcf186906..4dd037cf3c001 100644 --- a/docs/reference/search/request/highlighting.asciidoc +++ b/docs/reference/search/request/highlighting.asciidoc @@ -787,7 +787,7 @@ allow for highlighting using the postings: [source,js] -------------------------------------------------- -PUT /example +PUT /example?include_type_name=true { "mappings": { "doc" : { @@ -808,7 +808,7 @@ highlighting using the `term_vectors` (this will cause the index to be bigger): [source,js] -------------------------------------------------- -PUT /example +PUT /example?include_type_name=true { "mappings": { "doc" : { diff --git a/docs/reference/search/request/inner-hits.asciidoc b/docs/reference/search/request/inner-hits.asciidoc index a1eeeb8f06375..b67377edfe901 100644 --- a/docs/reference/search/request/inner-hits.asciidoc +++ b/docs/reference/search/request/inner-hits.asciidoc @@ -84,7 +84,7 @@ The nested `inner_hits` can be used to include nested inner objects as inner hit [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { @@ -210,7 +210,7 @@ including the source and solely rely on doc values fields. Like this: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { @@ -329,7 +329,7 @@ with the root hits then the following path can be defined: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { @@ -451,7 +451,7 @@ The parent/child `inner_hits` can be used to include parent or child: [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/search/request/post-filter.asciidoc b/docs/reference/search/request/post-filter.asciidoc index 636824bc067ca..b404a30a8250a 100644 --- a/docs/reference/search/request/post-filter.asciidoc +++ b/docs/reference/search/request/post-filter.asciidoc @@ -9,7 +9,7 @@ Imagine that you are selling shirts that have the following properties: [source,js] -------------------------------------------------- -PUT /shirts +PUT /shirts?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/search/request/sort.asciidoc b/docs/reference/search/request/sort.asciidoc index 1875c402adab4..fe7cf362ea36f 100644 --- a/docs/reference/search/request/sort.asciidoc +++ b/docs/reference/search/request/sort.asciidoc @@ -9,7 +9,7 @@ Assuming the following index mapping: [source,js] -------------------------------------------------- -PUT /my_index +PUT /my_index?include_type_name=true { "mappings": { "_doc": { diff --git a/docs/reference/search/suggesters/completion-suggest.asciidoc b/docs/reference/search/suggesters/completion-suggest.asciidoc index b2b7f7a443708..191f01f17394d 100644 --- a/docs/reference/search/suggesters/completion-suggest.asciidoc +++ b/docs/reference/search/suggesters/completion-suggest.asciidoc @@ -24,7 +24,7 @@ which indexes the field values for fast completions. [source,js] -------------------------------------------------- -PUT music +PUT music?include_type_name=true { "mappings": { "_doc" : { diff --git a/docs/reference/search/suggesters/context-suggest.asciidoc b/docs/reference/search/suggesters/context-suggest.asciidoc index ab52097a4c504..1ef8968188ccd 100644 --- a/docs/reference/search/suggesters/context-suggest.asciidoc +++ b/docs/reference/search/suggesters/context-suggest.asciidoc @@ -21,7 +21,7 @@ field: [source,js] -------------------------------------------------- -PUT place +PUT place?include_type_name=true { "mappings": { "_doc" : { @@ -44,7 +44,7 @@ PUT place } } } -PUT place_path_category +PUT place_path_category?include_type_name=true { "mappings": { "_doc" : { diff --git a/docs/reference/search/suggesters/phrase-suggest.asciidoc b/docs/reference/search/suggesters/phrase-suggest.asciidoc index 2bca0d81aa658..08a7aabd1c5de 100644 --- a/docs/reference/search/suggesters/phrase-suggest.asciidoc +++ b/docs/reference/search/suggesters/phrase-suggest.asciidoc @@ -23,7 +23,7 @@ work. The `reverse` analyzer is used only in the last example. [source,js] -------------------------------------------------- -PUT test +PUT test?include_type_name=true { "settings": { "index": { diff --git a/modules/lang-mustache/src/test/resources/rest-api-spec/test/lang_mustache/60_typed_keys.yml b/modules/lang-mustache/src/test/resources/rest-api-spec/test/lang_mustache/60_typed_keys.yml index 3ea1b31b04995..9c12aeaa530ea 100644 --- a/modules/lang-mustache/src/test/resources/rest-api-spec/test/lang_mustache/60_typed_keys.yml +++ b/modules/lang-mustache/src/test/resources/rest-api-spec/test/lang_mustache/60_typed_keys.yml @@ -1,36 +1,36 @@ setup: - do: indices.put_template: + include_type_name: false name: index_template body: index_patterns: test-* settings: number_of_replicas: 0 mappings: - user: - properties: - ip: - type: ip - integer: - type: integer - float: - type: float - name: - type: keyword + properties: + ip: + type: ip + integer: + type: integer + float: + type: float + name: + type: keyword - do: bulk: refresh: true body: - - '{"index": {"_index": "test-0", "_type": "user"}}' + - '{"index": {"_index": "test-0", "_type": "_doc"}}' - '{"ip": "10.0.0.1", "integer": 38, "float": 12.5713, "name": "Ruth", "bool": true}' - - '{"index": {"_index": "test-0", "_type": "user"}}' + - '{"index": {"_index": "test-0", "_type": "_doc"}}' - '{"ip": "10.0.0.2", "integer": 42, "float": 15.3393, "name": "Jackie", "surname": "Bowling", "bool": false}' - - '{"index": {"_index": "test-1", "_type": "user"}}' + - '{"index": {"_index": "test-1", "_type": "_doc"}}' - '{"ip": "10.0.0.3", "integer": 29, "float": 19.0517, "name": "Stephanie", "bool": true}' - - '{"index": {"_index": "test-1", "_type": "user"}}' + - '{"index": {"_index": "test-1", "_type": "_doc"}}' - '{"ip": "10.0.0.4", "integer": 19, "float": 19.3717, "surname": "Hamilton", "bool": true}' - - '{"index": {"_index": "test-2", "_type": "user"}}' + - '{"index": {"_index": "test-2", "_type": "_doc"}}' - '{"ip": "10.0.0.5", "integer": 0, "float": 17.3349, "name": "Natalie", "bool": false}' --- diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml index ae6e7559e2dfd..d20208f68e229 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml @@ -19,8 +19,8 @@ - do: indices.put_mapping: + include_type_name: false index: test - type: _doc body: properties: name: diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/rest/Netty4HeadBodyIsEmptyIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/rest/Netty4HeadBodyIsEmptyIT.java index 79b75487f6568..623633f690fe0 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/rest/Netty4HeadBodyIsEmptyIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/rest/Netty4HeadBodyIsEmptyIT.java @@ -44,17 +44,17 @@ public void testHeadRoot() throws IOException { } private void createTestDoc() throws IOException { - createTestDoc("test", "test"); + createTestDoc("test"); } - private void createTestDoc(final String indexName, final String typeName) throws IOException { + private void createTestDoc(final String indexName) throws IOException { try (XContentBuilder builder = jsonBuilder()) { builder.startObject(); { builder.field("test", "test"); } builder.endObject(); - Request request = new Request("PUT", "/" + indexName + "/" + typeName + "/" + "1"); + Request request = new Request("PUT", "/" + indexName + "/_doc/" + "1"); request.setJsonEntity(Strings.toString(builder)); client().performRequest(request); } @@ -62,9 +62,9 @@ private void createTestDoc(final String indexName, final String typeName) throws public void testDocumentExists() throws IOException { createTestDoc(); - headTestCase("/test/test/1", emptyMap(), greaterThan(0)); - headTestCase("/test/test/1", singletonMap("pretty", "true"), greaterThan(0)); - headTestCase("/test/test/2", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); + headTestCase("/test/_doc/1", emptyMap(), greaterThan(0)); + headTestCase("/test/_doc/1", singletonMap("pretty", "true"), greaterThan(0)); + headTestCase("/test/_doc/2", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); } public void testIndexExists() throws IOException { @@ -81,14 +81,14 @@ protected boolean getStrictDeprecationMode() { public void testTypeExists() throws IOException { createTestDoc(); - headTestCase("/test/_mapping/test", emptyMap(), greaterThan(0)); - headTestCase("/test/_mapping/test", singletonMap("pretty", "true"), greaterThan(0)); + headTestCase("/test/_mapping/_doc", emptyMap(), greaterThan(0)); + headTestCase("/test/_mapping/_doc", singletonMap("pretty", "true"), greaterThan(0)); } public void testTypeDoesNotExist() throws IOException { createTestDoc(); headTestCase("/test/_mapping/does-not-exist", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); - headTestCase("/text/_mapping/test,does-not-exist", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); + headTestCase("/text/_mapping/_doc,does-not-exist", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); } public void testAliasExists() throws IOException { @@ -157,13 +157,9 @@ public void testGetSourceAction() throws IOException { { builder.startObject("mappings"); { - builder.startObject("test-no-source"); + builder.startObject("_source"); { - builder.startObject("_source"); - { - builder.field("enabled", false); - } - builder.endObject(); + builder.field("enabled", false); } builder.endObject(); } @@ -174,7 +170,7 @@ public void testGetSourceAction() throws IOException { Request request = new Request("PUT", "/test-no-source"); request.setJsonEntity(Strings.toString(builder)); client().performRequest(request); - createTestDoc("test-no-source", "test-no-source"); + createTestDoc("test-no-source"); headTestCase("/test-no-source/_source/1", emptyMap(), NOT_FOUND.getStatus(), greaterThan(0)); } } diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java index e8bd2d95697a8..46038da21dfc0 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java @@ -60,6 +60,7 @@ import static org.elasticsearch.cluster.routing.UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING; import static org.elasticsearch.cluster.routing.allocation.decider.MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -901,6 +902,13 @@ public void testSnapshotRestore() throws IOException { templateBuilder.endObject().endObject(); Request createTemplateRequest = new Request("PUT", "/_template/test_template"); createTemplateRequest.setJsonEntity(Strings.toString(templateBuilder)); + + // In 7.0, type names are no longer expected by default in put index template requests. + // We therefore use the deprecated typed APIs when running against the current version. + if (isRunningAgainstOldCluster() == false) { + createTemplateRequest.addParameter(INCLUDE_TYPE_NAME_PARAMETER, "true"); + } + client().performRequest(createTemplateRequest); if (isRunningAgainstOldCluster()) { @@ -1094,7 +1102,15 @@ private void checkSnapshot(String snapshotName, int count, Version tookOnVersion assertThat(persistentSettings.get("cluster.routing.allocation.exclude.test_attr"), equalTo(getOldClusterVersion().toString())); // Check that the template was restored successfully - Map getTemplateResponse = entityAsMap(client().performRequest(new Request("GET", "/_template/test_template"))); + Request getTemplateRequest = new Request("GET", "/_template/test_template"); + + // In 7.0, type names are no longer returned by default in get index template requests. + // We therefore use the deprecated typed APIs when running against the current version. + if (isRunningAgainstOldCluster() == false) { + getTemplateRequest.addParameter(INCLUDE_TYPE_NAME_PARAMETER, "true"); + } + + Map getTemplateResponse = entityAsMap(client().performRequest(getTemplateRequest)); Map expectedTemplate = new HashMap<>(); if (isRunningAgainstOldCluster() && getOldClusterVersion().before(Version.V_6_0_0_beta1)) { expectedTemplate.put("template", "evil_*"); diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/10_basic.yml index e58e2bd8aa1fc..19bc94870cb47 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/10_basic.yml @@ -3,7 +3,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.create: include_type_name: false @@ -14,7 +14,6 @@ - do: indices.get_mapping: - include_type_name: false index: test_index - is_true: test_index.mappings @@ -24,7 +23,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.create: include_type_name: false @@ -44,7 +43,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.create: include_type_name: false @@ -58,7 +57,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.create: include_type_name: false @@ -76,7 +75,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.create: include_type_name: false diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/11_basic_with_types.yml index 6f7c5a6009386..f5aeb53751119 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/11_basic_with_types.yml @@ -3,6 +3,7 @@ - do: indices.create: + include_type_name: true index: test_index body: mappings: @@ -10,6 +11,7 @@ - do: indices.get_mapping: + include_type_name: true index: test_index - is_true: test_index.mappings.type_1 @@ -19,6 +21,7 @@ - do: indices.create: + include_type_name: true index: test_index body: settings: @@ -35,6 +38,7 @@ - do: indices.create: + include_type_name: true index: test_index - match: { acknowledged: true } @@ -45,6 +49,7 @@ - do: indices.create: + include_type_name: true index: test_index wait_for_active_shards: all body: @@ -59,6 +64,7 @@ - do: indices.create: + include_type_name: true index: test_index body: mappings: @@ -93,6 +99,7 @@ reason: is_write_index is not implemented in ES <= 6.x - do: indices.create: + include_type_name: true index: test_index body: aliases: @@ -115,6 +122,7 @@ - do: catch: /illegal_argument_exception/ indices.create: + include_type_name: true index: test_index body: mappings: @@ -125,6 +133,7 @@ - do: catch: /illegal_argument_exception/ indices.create: + include_type_name: true index: test_index body: mappings: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/10_basic.yml index b77c56d34160c..e215c43b4bdeb 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/10_basic.yml @@ -2,7 +2,7 @@ setup: - skip: version: " - 6.99.99" - reason: include_type_name is not supported before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -18,7 +18,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false fields: text - match: {test_index.mappings.text.mapping.text.type: text} @@ -27,7 +26,6 @@ setup: "Get field mapping by index only": - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: text @@ -38,7 +36,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: [ text , text1 ] @@ -50,7 +47,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: text include_defaults: true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/11_basic_with_types.yml index 6cf0a0b7cf26c..d45f0671db5a6 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/11_basic_with_types.yml @@ -15,6 +15,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true fields: text - match: {test_index.mappings.test_type.text.mapping.text.type: text} @@ -23,6 +24,7 @@ setup: "Get field mapping by index only": - do: indices.get_field_mapping: + include_type_name: true index: test_index fields: text @@ -33,6 +35,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index type: test_type fields: text @@ -44,6 +47,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index type: test_type fields: [ text , text1 ] @@ -56,6 +60,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index type: test_type fields: text @@ -69,6 +74,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true type: test_type fields: text diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/20_missing_field.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/20_missing_field.yml index 61f1f409d2939..3bc1c349039c0 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/20_missing_field.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/20_missing_field.yml @@ -2,7 +2,7 @@ "Return empty object if field doesn't exist, but type and index do": - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/21_missing_field_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/21_missing_field_with_types.yml index c760561f09282..c715d27ebc26f 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/21_missing_field_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/21_missing_field_with_types.yml @@ -14,6 +14,7 @@ - do: indices.get_field_mapping: + include_type_name: true index: test_index type: test_type fields: not_existent diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/30_missing_type.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/30_missing_type.yml index dfbd9a4af77a4..bbafb3e43f1a7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/30_missing_type.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/30_missing_type.yml @@ -15,6 +15,7 @@ - do: catch: missing indices.get_field_mapping: + include_type_name: true index: test_index type: not_test_type fields: text diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/40_missing_index.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/40_missing_index.yml index 7c7b07b587849..2273867816c6e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/40_missing_index.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/40_missing_index.yml @@ -4,6 +4,7 @@ - do: catch: missing indices.get_field_mapping: + include_type_name: false index: test_index fields: field diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/50_field_wildcards.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/50_field_wildcards.yml index 3ffecdcc72618..435259fb3b07d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/50_field_wildcards.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/50_field_wildcards.yml @@ -2,7 +2,7 @@ setup: - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -48,7 +48,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false fields: "*" - match: {test_index.mappings.t1.full_name: t1 } @@ -62,7 +61,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: "t*" @@ -75,7 +73,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: "*t1" - match: {test_index.mappings.t1.full_name: t1 } @@ -88,7 +85,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: test_index fields: "obj.i_*" - match: {test_index.mappings.obj\.i_t1.full_name: obj.i_t1 } @@ -100,7 +96,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: _all fields: "t*" - match: {test_index.mappings.t1.full_name: t1 } @@ -115,7 +110,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: '*' fields: "t*" - match: {test_index.mappings.t1.full_name: t1 } @@ -130,7 +124,6 @@ setup: - do: indices.get_field_mapping: - include_type_name: false index: 'test_index,test_index_2' fields: "t*" - match: {test_index.mappings.t1.full_name: t1 } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/51_field_wildcards_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/51_field_wildcards_with_types.yml index 9d62ab6101fc2..fe0c135f13ad7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/51_field_wildcards_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/51_field_wildcards_with_types.yml @@ -45,6 +45,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true fields: "*" - match: {test_index.mappings.test_type.t1.full_name: t1 } @@ -58,6 +59,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index fields: "t*" @@ -70,6 +72,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index fields: "*t1" - match: {test_index.mappings.test_type.t1.full_name: t1 } @@ -82,6 +85,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: test_index fields: "obj.i_*" - match: {test_index.mappings.test_type.obj\.i_t1.full_name: obj.i_t1 } @@ -93,6 +97,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: _all type: _all fields: "t*" @@ -108,6 +113,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: '*' type: '*' fields: "t*" @@ -123,6 +129,7 @@ setup: - do: indices.get_field_mapping: + include_type_name: true index: 'test_index,test_index_2' type: 'test_type,test_type_2' fields: "t*" diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/60_mix_typeless_typeful.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/60_mix_typeless_typeful.yml index d7ea620bb6c58..862075f450e73 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/60_mix_typeless_typeful.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_field_mapping/60_mix_typeless_typeful.yml @@ -1,10 +1,6 @@ --- "GET mapping with typeless API on an index that has types": - - skip: - version: " - 6.99.99" - reason: include_type_name was introduced in 7.0.0 - - do: indices.create: # not using include_type_name: false on purpose index: index diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/10_basic.yml index ccebfc7c9423b..d9ea7d325e3a8 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/10_basic.yml @@ -2,7 +2,7 @@ setup: - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -25,7 +25,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: t - match: { t.mappings: {}} @@ -34,8 +33,7 @@ setup: "Get /_mapping": - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - is_true: test_1.mappings - is_true: test_2.mappings @@ -45,7 +43,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: test_1 - is_true: test_1.mappings @@ -58,7 +55,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: _all - is_true: test_1.mappings @@ -69,7 +65,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: '*' - is_true: test_1.mappings @@ -80,7 +75,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: test_1,test_2 - is_true: test_1.mappings @@ -91,7 +85,6 @@ setup: - do: indices.get_mapping: - include_type_name: false index: '*2' - is_true: test_2.mappings diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/11_basic_with_types.yml index 90bb2747a7bfc..1c26a2a3d3d13 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/11_basic_with_types.yml @@ -21,6 +21,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: t - match: { t.mappings: {}} @@ -29,7 +30,8 @@ setup: "Get /_mapping": - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - is_true: test_1.mappings.doc - is_true: test_2.mappings.doc @@ -39,6 +41,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1 - is_true: test_1.mappings.doc @@ -50,6 +53,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1 type: _all @@ -61,6 +65,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1 type: '*' @@ -72,6 +77,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1 type: doc @@ -83,6 +89,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1 type: 'd*' @@ -94,6 +101,7 @@ setup: - do: indices.get_mapping: + include_type_name: true type: doc - is_true: test_1.mappings.doc @@ -104,6 +112,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: _all type: doc @@ -115,6 +124,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: '*' type: doc @@ -126,6 +136,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: test_1,test_2 type: doc @@ -137,6 +148,7 @@ setup: - do: indices.get_mapping: + include_type_name: true index: '*2' type: doc diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/20_missing_type.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/20_missing_type.yml index eecf1786e00c7..2f03bf7df5014 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/20_missing_type.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/20_missing_type.yml @@ -14,6 +14,7 @@ - do: catch: missing indices.get_mapping: + include_type_name: true index: test_index type: not_test_type @@ -36,6 +37,7 @@ - do: catch: missing indices.get_mapping: + include_type_name: true index: test_index type: test*,not* @@ -59,6 +61,7 @@ - do: catch: missing indices.get_mapping: + include_type_name: true index: test_index type: test_type,not_test_type @@ -82,6 +85,7 @@ - do: catch: missing indices.get_mapping: + include_type_name: true index: test_index type: test_type,not_test_type,another_not_test_type @@ -94,5 +98,6 @@ - do: catch: missing indices.get_mapping: + include_type_name: true type: not_test_type diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/30_missing_index.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/30_missing_index.yml index 4d3abb292f467..9b422ec8b9156 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/30_missing_index.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/30_missing_index.yml @@ -3,11 +3,11 @@ - do: catch: missing indices.get_mapping: + include_type_name: false index: test_index - type: not_test_type --- -"Index missing, no indexes, no types": +"Index missing, no indexes": - do: catch: missing indices.get_mapping: @@ -20,6 +20,7 @@ reason: ignore_unavailable was ignored in previous versions - do: indices.get_mapping: + include_type_name: false index: test_index ignore_unavailable: true @@ -30,6 +31,7 @@ - do: catch: missing indices.get_mapping: + include_type_name: false index: test_index ignore_unavailable: true allow_no_indices: false diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/40_aliases.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/40_aliases.yml index a608566544182..7afd10e1109eb 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/40_aliases.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/40_aliases.yml @@ -19,8 +19,9 @@ - do: indices.get_mapping: + include_type_name: false index: test_alias - - match: {test_index.mappings.test_type.properties.text.type: text} - - match: {test_index.mappings.test_type.properties.text.analyzer: whitespace} + - match: {test_index.mappings.properties.text.type: text} + - match: {test_index.mappings.properties.text.analyzer: whitespace} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml index d1a95b2690745..8f8ff8f9fc102 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/50_wildcard_expansion.yml @@ -54,43 +54,47 @@ setup: - do: indices.get_mapping: + include_type_name: false index: test-x* - - is_true: test-xxx.mappings.type_1 - - is_true: test-xxy.mappings.type_2 + - is_true: test-xxx.mappings + - is_true: test-xxy.mappings --- "Get test-* with wildcard_expansion=all": - do: indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: all - - is_true: test-xxx.mappings.type_1 - - is_true: test-xxy.mappings.type_2 - - is_true: test-xyy.mappings.type_3 + - is_true: test-xxx.mappings + - is_true: test-xxy.mappings + - is_true: test-xyy.mappings --- "Get test-* with wildcard_expansion=open": - do: indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: open - - is_true: test-xxx.mappings.type_1 - - is_true: test-xxy.mappings.type_2 + - is_true: test-xxx.mappings + - is_true: test-xxy.mappings --- "Get test-* with wildcard_expansion=closed": - do: indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: closed - - is_true: test-xyy.mappings.type_3 + - is_true: test-xyy.mappings --- "Get test-* with wildcard_expansion=none": @@ -99,6 +103,7 @@ setup: reason: allow_no_indices (defaults to true) was ignored in previous versions - do: indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: none @@ -111,6 +116,7 @@ setup: - do: catch: missing indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: none allow_no_indices: false @@ -119,9 +125,10 @@ setup: - do: indices.get_mapping: + include_type_name: false index: test-x* expand_wildcards: open,closed - - is_true: test-xxx.mappings.type_1 - - is_true: test-xxy.mappings.type_2 - - is_true: test-xyy.mappings.type_3 + - is_true: test-xxx.mappings + - is_true: test-xxy.mappings + - is_true: test-xyy.mappings diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/60_empty.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/60_empty.yml index dfba78578bbfe..e2a502f30a84d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/60_empty.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/60_empty.yml @@ -1,6 +1,8 @@ --- setup: - + - skip: + version: " - 6.99.99" + reason: include_type_name defaults to true before 7.0 - do: indices.create: index: test_1 diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/61_empty_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/61_empty_with_types.yml new file mode 100644 index 0000000000000..6da7f4a2c6946 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_mapping/61_empty_with_types.yml @@ -0,0 +1,20 @@ +--- +setup: + + - do: + indices.create: + index: test_1 + + - do: + indices.create: + index: test_2 + +--- +"Check empty mapping when getting all mappings via /_mapping": + + - do: + indices.get_mapping: + include_type_name: true + + - match: { test_1.mappings: {}} + - match: { test_2.mappings: {}} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/10_basic.yml index 8fe244e0c6323..c1aac94bf1d84 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/10_basic.yml @@ -1,7 +1,7 @@ setup: - skip: version: " - 6.99.99" - reason: include_type_name is not supported before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.put_template: name: test @@ -11,17 +11,15 @@ setup: number_of_shards: 1 number_of_replicas: 0 mappings: - _doc: - properties: - field: - type: keyword + properties: + field: + type: keyword --- "Get template": - do: indices.get_template: - include_type_name: false name: test - match: {test.index_patterns: ["test-*"]} @@ -42,7 +40,6 @@ setup: - do: indices.get_template: - include_type_name: false name: test_no_mappings - match: {test_no_mappings.index_patterns: ["test-*"]} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/11_basic_with_types.yml index c15f5dc6de4f1..0ecf304b1ce70 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/11_basic_with_types.yml @@ -1,6 +1,7 @@ setup: - do: indices.put_template: + include_type_name: true name: test body: index_patterns: test-* @@ -18,6 +19,7 @@ setup: - do: indices.get_template: + include_type_name: true name: test - match: {test.index_patterns: ["test-*"]} @@ -38,6 +40,7 @@ setup: - do: indices.get_template: + include_type_name: true name: test_no_mappings - match: {test_no_mappings.index_patterns: ["test-*"]} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/20_get_missing.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/20_get_missing.yml index 2751f57dacb6c..13d05efc67151 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/20_get_missing.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/20_get_missing.yml @@ -9,5 +9,6 @@ setup: - do: catch: missing indices.get_template: + include_type_name: false name: test diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/10_basic.yml index e4545320a973c..443e33d2c33a4 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/10_basic.yml @@ -1,9 +1,8 @@ --- "Test Create and update mapping": - - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -11,7 +10,6 @@ - do: indices.put_mapping: - include_type_name: false index: test_index body: properties: @@ -26,7 +24,6 @@ - do: indices.get_mapping: - include_type_name: false index: test_index - match: {test_index.mappings.properties.text1.type: text} @@ -36,7 +33,6 @@ - do: indices.put_mapping: - include_type_name: false index: test_index body: properties: @@ -50,7 +46,6 @@ - do: indices.get_mapping: - include_type_name: false index: test_index - match: {test_index.mappings.properties.text1.type: text} @@ -62,7 +57,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -70,7 +65,6 @@ - do: catch: /illegal_argument_exception/ indices.put_mapping: - include_type_name: false index: test_index body: properties: @@ -82,7 +76,7 @@ - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: index: index @@ -93,8 +87,8 @@ indices.put_mapping: index: index type: _doc - include_type_name: false body: properties: bar: type: float + diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/11_basic_with_types.yml index 1d33f2d31bb15..5da9cd4bf707c 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/11_basic_with_types.yml @@ -6,6 +6,7 @@ - do: indices.put_mapping: + include_type_name: true index: test_index type: test_type body: @@ -22,6 +23,7 @@ - do: indices.get_mapping: + include_type_name: true index: test_index - match: {test_index.mappings.test_type.properties.text1.type: text} @@ -31,6 +33,7 @@ - do: indices.put_mapping: + include_type_name: true index: test_index type: test_type body: @@ -46,6 +49,7 @@ - do: indices.get_mapping: + include_type_name: true index: test_index - match: {test_index.mappings.test_type.properties.text1.type: text} @@ -60,6 +64,7 @@ - do: catch: /illegal_argument_exception/ indices.put_mapping: + include_type_name: true index: test_index type: test_type body: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/20_mix_typeless_typeful.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/20_mix_typeless_typeful.yml index 5f9efb1a3750c..3aedff101110b 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/20_mix_typeless_typeful.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/20_mix_typeless_typeful.yml @@ -1,12 +1,9 @@ --- "PUT mapping with typeless API on an index that has types": - - skip: - version: " - 6.99.99" - reason: include_type_name was introduced in 7.0.0 - - do: indices.create: # not using include_type_name: false on purpose + include_type_name: true index: index body: mappings: @@ -44,6 +41,7 @@ - do: catch: bad_request indices.put_mapping: + include_type_name: true index: index body: some_other_type: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options.yml index c6212fbbd8fa5..44796defef7c5 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options.yml @@ -1,7 +1,7 @@ setup: - skip: version: " - 6.99.99" - reason: types are required in requests before 7.0.0 + reason: include_type_name defaults to true before 7.0 - do: indices.create: include_type_name: false @@ -20,7 +20,6 @@ setup: "put one mapping per index": - do: indices.put_mapping: - include_type_name: false index: test_index1 body: properties: @@ -29,7 +28,6 @@ setup: analyzer: whitespace - do: indices.put_mapping: - include_type_name: false index: test_index2 body: properties: @@ -39,8 +37,7 @@ setup: - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} - match: {test_index1.mappings.properties.text.analyzer: whitespace} @@ -55,7 +52,6 @@ setup: - do: indices.put_mapping: - include_type_name: false index: _all body: properties: @@ -64,8 +60,7 @@ setup: analyzer: whitespace - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} - match: {test_index1.mappings.properties.text.analyzer: whitespace} @@ -80,7 +75,6 @@ setup: "put mapping in * index": - do: indices.put_mapping: - include_type_name: false index: "*" body: properties: @@ -89,8 +83,7 @@ setup: analyzer: whitespace - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} - match: {test_index1.mappings.properties.text.analyzer: whitespace} @@ -105,7 +98,6 @@ setup: "put mapping in prefix* index": - do: indices.put_mapping: - include_type_name: false index: "test_index*" body: properties: @@ -114,8 +106,7 @@ setup: analyzer: whitespace - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} - match: {test_index1.mappings.properties.text.analyzer: whitespace} @@ -129,7 +120,6 @@ setup: "put mapping in list of indices": - do: indices.put_mapping: - include_type_name: false index: [test_index1, test_index2] body: properties: @@ -138,8 +128,7 @@ setup: analyzer: whitespace - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} - match: {test_index1.mappings.properties.text.analyzer: whitespace} @@ -154,7 +143,6 @@ setup: - do: indices.put_mapping: - include_type_name: false index: test_index1 body: dynamic: false @@ -165,7 +153,6 @@ setup: - do: indices.put_mapping: - include_type_name: false index: test_index1 body: dynamic: false @@ -175,8 +162,7 @@ setup: type: text - do: - indices.get_mapping: - include_type_name: false + indices.get_mapping: {} - match: {test_index1.mappings.properties.text.type: text} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options_with_types.yml index e125ec2a70f4e..6f9b6f7d9ceef 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_mapping/all_path_options_with_types.yml @@ -14,6 +14,7 @@ setup: "put one mapping per index": - do: indices.put_mapping: + include_type_name: true index: test_index1 type: test_type body: @@ -24,6 +25,7 @@ setup: analyzer: whitespace - do: indices.put_mapping: + include_type_name: true index: test_index2 type: test_type body: @@ -35,7 +37,8 @@ setup: - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -50,6 +53,7 @@ setup: - do: indices.put_mapping: + include_type_name: true index: _all type: test_type body: @@ -60,7 +64,8 @@ setup: analyzer: whitespace - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -75,6 +80,7 @@ setup: "put mapping in * index": - do: indices.put_mapping: + include_type_name: true index: "*" type: test_type body: @@ -85,7 +91,8 @@ setup: analyzer: whitespace - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -100,6 +107,7 @@ setup: "put mapping in prefix* index": - do: indices.put_mapping: + include_type_name: true index: "test_index*" type: test_type body: @@ -110,7 +118,8 @@ setup: analyzer: whitespace - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -124,6 +133,7 @@ setup: "put mapping in list of indices": - do: indices.put_mapping: + include_type_name: true index: [test_index1, test_index2] type: test_type body: @@ -134,7 +144,8 @@ setup: analyzer: whitespace - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -148,6 +159,7 @@ setup: "put mapping with blank index": - do: indices.put_mapping: + include_type_name: true type: test_type body: test_type: @@ -157,7 +169,8 @@ setup: analyzer: whitespace - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} - match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace} @@ -174,13 +187,15 @@ setup: - do: catch: param - indices.put_mapping: {} + indices.put_mapping: + include_type_name: true --- "post a mapping with default analyzer twice": - do: indices.put_mapping: + include_type_name: true index: test_index1 type: test_type body: @@ -193,6 +208,7 @@ setup: - do: indices.put_mapping: + include_type_name: true index: test_index1 type: test_type body: @@ -204,7 +220,8 @@ setup: type: text - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: true - match: {test_index1.mappings.test_type.properties.text.type: text} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yml index 8637b3e6d1864..c0b0bbe5d30b7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yml @@ -2,11 +2,10 @@ "Put template": - skip: version: " - 6.99.99" - reason: include_type_name is not supported before 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.put_template: - include_type_name: false name: test body: index_patterns: test-* @@ -20,7 +19,6 @@ - do: indices.get_template: - include_type_name: false name: test flat_settings: true @@ -32,11 +30,10 @@ "Put multiple template": - skip: version: " - 6.99.99" - reason: include_type_name was introduced in 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.put_template: - include_type_name: false name: test body: index_patterns: [test-*, test2-*] @@ -50,7 +47,6 @@ - do: indices.get_template: - include_type_name: false name: test flat_settings: true @@ -62,11 +58,10 @@ "Put template with empty mappings": - skip: version: " - 6.99.99" - reason: include_type_name was introduced in 7.0.0 + reason: include_type_name defaults to true before 7.0.0 - do: indices.put_template: - include_type_name: false name: test body: index_patterns: test-* @@ -77,7 +72,6 @@ - do: indices.get_template: - include_type_name: false name: test flat_settings: true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/11_basic_with_types.yml index 1e14a9d3895a7..fde28db3c691d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/11_basic_with_types.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/11_basic_with_types.yml @@ -2,6 +2,7 @@ "Put template": - do: indices.put_template: + include_type_name: true name: test body: index_patterns: test-* @@ -16,6 +17,7 @@ - do: indices.get_template: + include_type_name: true name: test flat_settings: true @@ -27,6 +29,7 @@ "Put multiple template": - do: indices.put_template: + include_type_name: true name: test body: index_patterns: [test-*, test2-*] @@ -41,6 +44,7 @@ - do: indices.get_template: + include_type_name: true name: test flat_settings: true @@ -52,6 +56,7 @@ "Put template with empty mappings": - do: indices.put_template: + include_type_name: true name: test body: index_patterns: test-* @@ -62,6 +67,7 @@ - do: indices.get_template: + include_type_name: true name: test flat_settings: true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/20_source_mapping.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/20_source_mapping.yml index 2e7a13b38e10e..c5715f7d4b2d5 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/20_source_mapping.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/20_source_mapping.yml @@ -39,14 +39,14 @@ # create template matching shrink target - do: indices.put_template: + include_type_name: false name: tpl1 body: index_patterns: targ* mappings: - test: - properties: - count: - type: integer + properties: + count: + type: integer # make it read-only - do: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml index 727e1e374ba65..0827860d88fdf 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.split/20_source_mapping.yml @@ -32,14 +32,14 @@ # create template matching shrink target - do: indices.put_template: + include_type_name: false name: tpl1 body: index_patterns: targ* mappings: - test: - properties: - count: - type: integer + properties: + count: + type: integer # make it read-only - do: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/110_field_collapsing.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/110_field_collapsing.yml index 885fdbdd06b1b..7ba1d9b62fbc7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search/110_field_collapsing.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/110_field_collapsing.yml @@ -383,12 +383,11 @@ setup: reason: Field aliases were introduced in 6.4.0. - do: indices.put_mapping: + include_type_name: false index: test - type: test body: - test: - properties: - group_alias: { type: alias, path: numeric_group } + properties: + group_alias: { type: alias, path: numeric_group } - do: search: rest_total_hits_as_int: true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/suggest/30_context.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/suggest/30_context.yml index 9ddbc922f614b..94233decd2217 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/suggest/30_context.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/suggest/30_context.yml @@ -195,7 +195,8 @@ setup: indices.refresh: {} - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: false - do: search: @@ -247,7 +248,8 @@ setup: indices.refresh: {} - do: - indices.get_mapping: {} + indices.get_mapping: + include_type_name: false - do: search: diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java index c7e64143f9c9a..9482a42a56e45 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java @@ -47,6 +47,7 @@ import java.util.Objects; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.elasticsearch.rest.BaseRestHandler.DEFAULT_INCLUDE_TYPE_NAME_POLICY; import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; /** @@ -254,7 +255,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.endObject(); ImmutableOpenMap indexMappings = mappings.get(index); - boolean includeTypeName = params.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, false); + boolean includeTypeName = params.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); if (includeTypeName) { builder.startObject("mappings"); if (indexMappings != null) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java index 2c07ebc68d0ef..f24c75d988e88 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java @@ -48,6 +48,7 @@ import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.elasticsearch.rest.BaseRestHandler.DEFAULT_INCLUDE_TYPE_NAME_POLICY; /** Response object for {@link GetFieldMappingsRequest} API */ public class GetFieldMappingsResponse extends ActionResponse implements ToXContentObject { @@ -114,7 +115,8 @@ public FieldMappingMetaData fieldMappings(String index, String type, String fiel @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - boolean includeTypeName = params.paramAsBoolean(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, true); + boolean includeTypeName = params.paramAsBoolean(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); builder.startObject(); for (Map.Entry>> indexEntry : mappings.entrySet()) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java index ad864c94e3693..4c037bd1d6df9 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java @@ -31,10 +31,13 @@ import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.rest.BaseRestHandler; import java.io.IOException; import java.util.Map; +import static org.elasticsearch.rest.BaseRestHandler.DEFAULT_INCLUDE_TYPE_NAME_POLICY; + public class GetMappingsResponse extends ActionResponse implements ToXContentFragment { private static final ParseField MAPPINGS = new ParseField("mappings"); @@ -119,10 +122,9 @@ public static GetMappingsResponse fromXContent(XContentParser parser) throws IOE @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - return toXContent(builder, params, true); - } + boolean includeTypeName = params.paramAsBoolean(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); - public XContentBuilder toXContent(XContentBuilder builder, Params params, boolean includeTypeName) throws IOException { for (final ObjectObjectCursor> indexEntry : getMappings()) { builder.startObject(indexEntry.key); { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java index 2bdc966c74e59..9749aaa05b1a4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java @@ -32,6 +32,8 @@ import java.util.List; import static java.util.Collections.singletonMap; +import static org.elasticsearch.rest.BaseRestHandler.DEFAULT_INCLUDE_TYPE_NAME_POLICY; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; public class GetIndexTemplatesResponse extends ActionResponse implements ToXContentObject { @@ -71,9 +73,17 @@ public void writeTo(StreamOutput out) throws IOException { @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { params = new ToXContent.DelegatingMapParams(singletonMap("reduce_mappings", "true"), params); + + boolean includeTypeName = params.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); + builder.startObject(); for (IndexTemplateMetaData indexTemplateMetaData : getIndexTemplates()) { - IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); + if (includeTypeName) { + IndexTemplateMetaData.Builder.toXContentWithTypes(indexTemplateMetaData, builder, params); + } else { + IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); + } } builder.endObject(); return builder; diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java index 4055af3e2f460..e21aa95865a6f 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java @@ -42,7 +42,6 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.mapper.MapperService; -import org.elasticsearch.rest.BaseRestHandler; import java.io.IOException; import java.util.ArrayList; @@ -331,19 +330,47 @@ public IndexTemplateMetaData build() { return new IndexTemplateMetaData(name, order, version, indexPatterns, settings, mappings.build(), aliases.build()); } - public static void toXContent(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder, ToXContent.Params params) - throws IOException { + /** + * Serializes the template to xContent, using the legacy format where the mappings are + * nested under the type name. + * + * This method is used for serializing templates before storing them in the cluster metadata, + * and also in the REST layer when returning a deprecated typed response. + */ + public static void toXContentWithTypes(IndexTemplateMetaData indexTemplateMetaData, + XContentBuilder builder, + ToXContent.Params params) throws IOException { builder.startObject(indexTemplateMetaData.name()); + toInnerXContent(indexTemplateMetaData, builder, params, true); + builder.endObject(); + } - toInnerXContent(indexTemplateMetaData, builder, params); - + /** + * Serializes the template to xContent, making sure not to nest mappings under the + * type name. + * + * Note that this method should currently only be used for creating REST responses, + * and not when directly updating stored templates. Index templates are still stored + * in the old, typed format, and have yet to be migrated to be typeless. + */ + public static void toXContent(IndexTemplateMetaData indexTemplateMetaData, + XContentBuilder builder, + ToXContent.Params params) throws IOException { + builder.startObject(indexTemplateMetaData.name()); + toInnerXContent(indexTemplateMetaData, builder, params, false); builder.endObject(); } - public static void toInnerXContent(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder, ToXContent.Params params) - throws IOException { + static void toInnerXContentWithTypes(IndexTemplateMetaData indexTemplateMetaData, + XContentBuilder builder, + ToXContent.Params params) throws IOException { + toInnerXContent(indexTemplateMetaData, builder, params, true); + } - boolean includeTypeName = params.paramAsBoolean(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, true); + private static void toInnerXContent(IndexTemplateMetaData indexTemplateMetaData, + XContentBuilder builder, + ToXContent.Params params, + boolean includeTypeName) throws IOException { builder.field("order", indexTemplateMetaData.order()); if (indexTemplateMetaData.version() != null) { diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java index a9ec770720732..3cce3f791d2b8 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java @@ -1245,7 +1245,7 @@ public static void toXContent(MetaData metaData, XContentBuilder builder, ToXCon builder.startObject("templates"); for (ObjectCursor cursor : metaData.templates().values()) { - IndexTemplateMetaData.Builder.toXContent(cursor.value, builder, params); + IndexTemplateMetaData.Builder.toXContentWithTypes(cursor.value, builder, params); } builder.endObject(); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java index 227dca6b739bc..deb04067acb9a 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java @@ -253,7 +253,7 @@ Optional, Set>> calculateTemplateChang private BytesReference toBytesReference(IndexTemplateMetaData templateMetaData) { try { return XContentHelper.toXContent((builder, params) -> { - IndexTemplateMetaData.Builder.toInnerXContent(templateMetaData, builder, params); + IndexTemplateMetaData.Builder.toInnerXContentWithTypes(templateMetaData, builder, params); return builder; }, XContentType.JSON, PARAMS, false); } catch (IOException ex) { diff --git a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index 97b4e29d9a208..98611e4c9d8ab 100644 --- a/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -63,6 +63,7 @@ public abstract class BaseRestHandler extends AbstractComponent implements RestH * Note: Support for this parameter will be removed after the transition period to typeless APIs. */ public static final String INCLUDE_TYPE_NAME_PARAMETER = "include_type_name"; + public static final boolean DEFAULT_INCLUDE_TYPE_NAME_POLICY = false; protected BaseRestHandler(Settings settings) { // TODO drop settings from ctor diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index aa0867696c674..ed2724b95bb47 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -49,7 +49,8 @@ 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, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index")); if (request.hasContent()) { Map sourceAsMap = XContentHelper.convertToMap(request.content(), false, request.getXContentType()).v2(); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index f3a73fa29fd98..54cc9fd988f13 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -63,10 +63,10 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); final String[] fields = Strings.splitStringByCommaToArray(request.param("fields")); - boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); + boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); if (includeTypeName == false && types.length > 0) { - throw new IllegalArgumentException("Cannot set include_type_name=false and specify" + - " types at the same time."); + throw new IllegalArgumentException("Types cannot be specified unless include_type_name" + + " is set to true."); } GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest(); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index ee052f96a1a33..da7f2af501db2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.admin.indices; import com.carrotsearch.hppc.cursors.ObjectCursor; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; @@ -34,7 +33,6 @@ import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.set.Sets; -import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.indices.TypeMissingException; import org.elasticsearch.rest.BaseRestHandler; @@ -82,13 +80,17 @@ public String getName() { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { + final String[] indices = Strings.splitStringByCommaToArray(request.param("index")); + final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); + boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); + if (request.method().equals(HEAD)) { deprecationLogger.deprecated("Type exists requests are deprecated, as types have been deprecated."); + } else if (includeTypeName == false && types.length > 0) { + throw new IllegalArgumentException("Types cannot be provided in get mapping requests, unless" + + " include_type_name is set to true."); } - final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); - final String[] indices = Strings.splitStringByCommaToArray(request.param("index")); - final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); final GetMappingsRequest getMappingsRequest = new GetMappingsRequest(); getMappingsRequest.indices(indices).types(types); getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions())); @@ -139,7 +141,7 @@ public RestResponse buildResponse(final GetMappingsResponse response, final XCon builder.field("error", message); builder.field("status", status.getStatus()); } - response.toXContent(builder, ToXContent.EMPTY_PARAMS, includeTypeName); + response.toXContent(builder, request); } builder.endObject(); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index f5cc3c6aad26d..2b72a724a8906 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -68,7 +68,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC putRequest.create(request.paramAsBoolean("create", false)); putRequest.cause(request.param("cause", "")); - boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, true); + boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); Map sourceAsMap = prepareRequestSource(request, includeTypeName); putRequest.source(sourceAsMap); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 286bd82fd3501..525b398d48b7a 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -68,11 +68,13 @@ 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, + DEFAULT_INCLUDE_TYPE_NAME_POLICY); PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index"))); final String type = request.param("type"); if (type != null && includeTypeName == false) { - throw new IllegalArgumentException("Cannot set include_type_name=false and provide a type at the same time"); + throw new IllegalArgumentException("Types cannot be provided in put mapping requests, unless " + + "the include_type_name parameter is set to true."); } putMappingRequest.type(includeTypeName ? type : MapperService.SINGLE_MAPPING_NAME); putMappingRequest.source(request.requiredContent(), request.getXContentType()); diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponseTests.java index b6e785a4d05be..734de94b1c419 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponseTests.java @@ -24,6 +24,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.test.AbstractStreamableXContentTestCase; @@ -34,6 +35,7 @@ import java.util.Map; import java.util.function.Predicate; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.hamcrest.CoreMatchers.equalTo; public class GetFieldMappingsResponseTests extends AbstractStreamableXContentTestCase { @@ -121,6 +123,15 @@ protected Predicate getRandomFieldsExcludeFilter() { || s.matches("(?[^.]+)\\.mappings\\.(?[^.]+)\\.(?[^.]+)")); } + /** + * For now, we only unit test the legacy typed responses. This will soon no longer be the case, + * as we introduce support for typeless xContent parsing in {@link GetFieldMappingsResponse}. + */ + @Override + protected ToXContent.Params getToXContentParams() { + return new ToXContent.MapParams(Collections.singletonMap(INCLUDE_TYPE_NAME_PARAMETER, "true")); + } + private Map>> randomMapping() { Map>> mappings = new HashMap<>(); diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponseTests.java index 481d05ea8cc07..633d74acde174 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponseTests.java @@ -23,6 +23,7 @@ import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; +import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.test.AbstractStreamableXContentTestCase; @@ -30,12 +31,15 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; + public class GetMappingsResponseTests extends AbstractStreamableXContentTestCase { @Override @@ -125,6 +129,15 @@ protected GetMappingsResponse createTestInstance() { return resp; } + /** + * For now, we only unit test the legacy typed responses. This will soon no longer be the + * case, as we introduce support for typeless xContent parsing in {@link GetMappingsResponse}. + */ + @Override + protected ToXContent.Params getToXContentParams() { + return new ToXContent.MapParams(Collections.singletonMap(INCLUDE_TYPE_NAME_PARAMETER, "true")); + } + // Not meant to be exhaustive private static Map randomFieldMapping() { Map mappings = new HashMap<>(); diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponseTests.java index 6cb26967d07fa..0806ff76906b5 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponseTests.java @@ -19,20 +19,24 @@ package org.elasticsearch.action.admin.indices.template.get; +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.AbstractXContentTestCase; import java.io.IOException; import java.io.UncheckedIOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.hamcrest.Matchers.equalTo; public class GetIndexTemplatesResponseTests extends AbstractXContentTestCase { @@ -81,6 +85,15 @@ protected boolean supportsUnknownFields() { return false; } + /** + * For now, we only unit test the legacy typed responses. This will soon no longer be the case, + * as we introduce support for typeless xContent parsing in {@link GetFieldMappingsResponse}. + */ + @Override + protected ToXContent.Params getToXContentParams() { + return new ToXContent.MapParams(Collections.singletonMap(INCLUDE_TYPE_NAME_PARAMETER, "true")); + } + @Override protected void assertEqualInstances(GetIndexTemplatesResponse expectedInstance, GetIndexTemplatesResponse newInstance) { assertNotSame(newInstance, expectedInstance); diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaDataTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaDataTests.java index 5fc0764235417..03d10aca7e812 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaDataTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaDataTests.java @@ -62,7 +62,7 @@ public void testIndexTemplateMetaDataXContentRoundTrip() throws Exception { final BytesReference templateBytesRoundTrip; try (XContentBuilder builder = XContentBuilder.builder(JsonXContent.jsonXContent)) { builder.startObject(); - IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); + IndexTemplateMetaData.Builder.toXContentWithTypes(indexTemplateMetaData, builder, params); builder.endObject(); templateBytesRoundTrip = BytesReference.bytes(builder); } @@ -161,7 +161,7 @@ public void testFromToXContent() throws Exception { IndexTemplateMetaData template = templateBuilder.build(); XContentBuilder builder = XContentBuilder.builder(randomFrom(XContentType.JSON.xContent())); builder.startObject(); - IndexTemplateMetaData.Builder.toXContent(template, builder, ToXContent.EMPTY_PARAMS); + IndexTemplateMetaData.Builder.toXContentWithTypes(template, builder, ToXContent.EMPTY_PARAMS); builder.endObject(); try (XContentParser parser = createParser(shuffleXContent(builder))) { IndexTemplateMetaData parsed = IndexTemplateMetaData.Builder.fromXContent(parser, templateName); diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingActionTests.java index 8f9093df2fc8b..8eea9dc34c2fb 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingActionTests.java @@ -21,17 +21,21 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.rest.RestStatus; +import org.elasticsearch.test.rest.FakeRestChannel; import org.elasticsearch.test.rest.FakeRestRequest; +import org.elasticsearch.test.rest.RestActionTestCase; import java.util.HashMap; import java.util.Map; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.mockito.Mockito.mock; -public class RestGetMappingActionTests extends ESTestCase { +public class RestGetMappingActionTests extends RestActionTestCase { public void testTypeExistsDeprecation() throws Exception { Map params = new HashMap<>(); @@ -46,4 +50,23 @@ public void testTypeExistsDeprecation() throws Exception { assertWarnings("Type exists requests are deprecated, as types have been deprecated."); } + + public void testTypeInPath() { + // Test that specifying a type while setting include_type_name to false + // results in an illegal argument exception. + Map params = new HashMap<>(); + params.put(INCLUDE_TYPE_NAME_PARAMETER, "false"); + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(RestRequest.Method.GET) + .withPath("some_index/some_type/_mapping/some_field") + .withParams(params) + .build(); + + FakeRestChannel channel = new FakeRestChannel(request, false, 1); + ThreadContext threadContext = new ThreadContext(Settings.EMPTY); + controller().dispatchRequest(request, channel, threadContext); + + assertEquals(1, channel.errors().get()); + assertEquals(RestStatus.BAD_REQUEST, channel.capturedResponse().status()); + } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index c711019bf753c..668f837dcedf1 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -801,7 +801,9 @@ protected static void ensureNoInitializingShards() throws IOException { } protected static void createIndex(String name, Settings settings) throws IOException { - createIndex(name, settings, ""); + Request request = new Request("PUT", "/" + name); + request.setJsonEntity("{\n \"settings\": " + Strings.toString(settings) + "}"); + client().performRequest(request); } protected static void createIndex(String name, Settings settings, String mapping) throws IOException { diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java index b1337172a5679..d7ff384837562 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java @@ -40,6 +40,8 @@ import java.util.List; import java.util.Map; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; + /** * Execution context passed across the REST tests. * Holds the REST client used to communicate with elasticsearch. @@ -96,6 +98,14 @@ public ClientYamlTestResponse callApi(String apiName, Map params } } + // Although include_type_name defaults to false, there is a large number of typed index creations + // in REST tests that need to be manually converted to typeless calls. As a temporary measure, we + // specify include_type_name=true in indices.create calls, unless the parameter has been set otherwise. + // This workaround will be removed once we convert all index creations to be typeless. + if (apiName.equals("indices.create") && requestParams.containsKey(INCLUDE_TYPE_NAME_PARAMETER) == false) { + requestParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); + } + HttpEntity entity = createEntity(bodies, requestHeaders); try { response = callApiInternal(apiName, requestParams, entity, requestHeaders, nodeSelector); diff --git a/x-pack/docs/en/security/authorization/alias-privileges.asciidoc b/x-pack/docs/en/security/authorization/alias-privileges.asciidoc index b9b6d44fd69b7..aca6fc27b1dd8 100644 --- a/x-pack/docs/en/security/authorization/alias-privileges.asciidoc +++ b/x-pack/docs/en/security/authorization/alias-privileges.asciidoc @@ -54,7 +54,7 @@ added to an index directly as part of the index creation: [source,shell] ------------------------------------------------------------------------------- -PUT /2015 +PUT /2015?include_type_name=true { "aliases" : { "current_year" : {} diff --git a/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java b/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java index 26d7825198d8a..b612d8822437e 100644 --- a/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java +++ b/x-pack/plugin/ccr/qa/downgrade-to-basic-license/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java @@ -114,7 +114,7 @@ private void createNewIndexAndIndexDocs(RestClient client, String index) throws .build(); Request request = new Request("PUT", "/" + index); request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"_doc\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}} }"); + ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(client.performRequest(request)); for (int i = 0; i < 5; i++) { diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java index d1f28fa0da918..055c536faac39 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java @@ -38,7 +38,7 @@ public void testMultipleAutoFollowPatternsDifferentClusters() throws Exception { .build(); Request request = new Request("PUT", "/logs-20190101"); request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"_doc\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}} }"); + ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(leaderClient.performRequest(request)); for (int i = 0; i < 5; i++) { String id = Integer.toString(i); @@ -51,7 +51,7 @@ public void testMultipleAutoFollowPatternsDifferentClusters() throws Exception { .build(); Request request = new Request("PUT", "/logs-20200101"); request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"_doc\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}} }"); + ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(middleClient.performRequest(request)); for (int i = 0; i < 5; i++) { String id = Integer.toString(i); @@ -85,7 +85,7 @@ public void testAutoFollowPatterns() throws Exception { .build(); request = new Request("PUT", "/metrics-20210101"); request.setJsonEntity("{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"_doc\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}} }"); + ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"); assertOK(leaderClient.performRequest(request)); for (int i = 0; i < 5; i++) { diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java index e5a37aa829bbf..b3e6384f7f635 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/ChainIT.java @@ -20,12 +20,10 @@ public void testFollowIndex() throws Exception { String mapping = ""; if (randomBoolean()) { // randomly do source filtering on indexing mapping = - "\"_doc\": {" + - " \"_source\": {" + - " \"includes\": [\"field\"]," + - " \"excludes\": [\"filtered_field\"]" + - " }"+ - "}"; + "\"_source\": {" + + " \"includes\": [\"field\"]," + + " \"excludes\": [\"filtered_field\"]" + + "}"; } Settings indexSettings = Settings.builder() .put("index.soft_deletes.enabled", true) diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java index b44abb15fad15..b50fe9233e8fa 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java @@ -25,11 +25,9 @@ public void testFollowIndex() throws Exception { String mapping = ""; if (randomBoolean()) { // randomly do source filtering on indexing mapping = - "\"_doc\": {" + - " \"_source\": {" + - " \"includes\": [\"field\"]," + - " \"excludes\": [\"filtered_field\"]" + - " }"+ + "\"_source\": {" + + " \"includes\": [\"field\"]," + + " \"excludes\": [\"filtered_field\"]" + "}"; } Settings indexSettings = Settings.builder() diff --git a/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java b/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java index 2b902d2a18399..91b94f1c4b57d 100644 --- a/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java +++ b/x-pack/plugin/ccr/qa/security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java @@ -148,7 +148,7 @@ public void testAutoFollowPatterns() throws Exception { .put("index.soft_deletes.enabled", true) .build(); String requestBody = "{\"settings\": " + Strings.toString(settings) + - ", \"mappings\": {\"_doc\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}} }"; + ", \"mappings\": {\"properties\": {\"field\": {\"type\": \"keyword\"}}}}"; request = new Request("PUT", "/" + index); request.setJsonEntity(requestBody); assertOK(leaderClient.performRequest(request)); diff --git a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java b/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java index 0cfa6f5ebf04e..31b43eb055523 100644 --- a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java +++ b/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java @@ -106,12 +106,10 @@ public void testMiniFarequoteWithDatafeeder() throws Exception { Request createAirlineDataRequest = new Request("PUT", "/airline-data"); createAirlineDataRequest.setJsonEntity("{" + " \"mappings\": {" - + " \"_doc\": {" - + " \"properties\": {" - + " \"time\": { \"type\":\"date\"}," - + " \"airline\": { \"type\":\"keyword\"}," - + " \"responsetime\": { \"type\":\"float\"}" - + " }" + + " \"properties\": {" + + " \"time\": { \"type\":\"date\"}," + + " \"airline\": { \"type\":\"keyword\"}," + + " \"responsetime\": { \"type\":\"float\"}" + " }" + " }" + "}"); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java index 64d8f73c4a3e5..2e69702381bcf 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java @@ -13,7 +13,6 @@ import org.elasticsearch.client.RestClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.rest.action.document.RestBulkAction; import org.elasticsearch.test.SecuritySettingsSourceField; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner; @@ -105,12 +104,10 @@ private void addAirlineData() throws IOException { Request createEmptyAirlineDataRequest = new Request("PUT", "/airline-data-empty"); createEmptyAirlineDataRequest.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"properties\": {" - + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional - + " \"airline\": { \"type\":\"keyword\"}," - + " \"responsetime\": { \"type\":\"float\"}" - + " }" + + " \"properties\": {" + + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional + + " \"airline\": { \"type\":\"keyword\"}," + + " \"responsetime\": { \"type\":\"float\"}" + " }" + " }" + "}"); @@ -120,116 +117,106 @@ private void addAirlineData() throws IOException { Request createAirlineDataRequest = new Request("PUT", "/airline-data"); createAirlineDataRequest.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"properties\": {" - + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional - + " \"airline\": {" - + " \"type\":\"text\"," - + " \"fields\":{" - + " \"text\":{\"type\":\"text\"}," - + " \"keyword\":{\"type\":\"keyword\"}" - + " }" - + " }," - + " \"responsetime\": { \"type\":\"float\"}" - + " }" + + " \"properties\": {" + + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional + + " \"airline\": {" + + " \"type\":\"text\"," + + " \"fields\":{" + + " \"text\":{\"type\":\"text\"}," + + " \"keyword\":{\"type\":\"keyword\"}" + + " }" + + " }," + + " \"responsetime\": { \"type\":\"float\"}" + " }" + " }" + "}"); client().performRequest(createAirlineDataRequest); - bulk.append("{\"index\": {\"_index\": \"airline-data\", \"_type\": \"response\", \"_id\": 1}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data\", \"_id\": 1}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:00:00Z\",\"airline\":\"AAA\",\"responsetime\":135.22}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data\", \"_type\": \"response\", \"_id\": 2}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data\", \"_id\": 2}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:59:00Z\",\"airline\":\"AAA\",\"responsetime\":541.76}\n"); // Create index with source = enabled, doc_values = disabled (except time), stored = false Request createAirlineDataDisabledDocValues = new Request("PUT", "/airline-data-disabled-doc-values"); createAirlineDataDisabledDocValues.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"properties\": {" - + " \"time stamp\": { \"type\":\"date\"}," - + " \"airline\": { \"type\":\"keyword\", \"doc_values\":false}," - + " \"responsetime\": { \"type\":\"float\", \"doc_values\":false}" - + " }" + + " \"properties\": {" + + " \"time stamp\": { \"type\":\"date\"}," + + " \"airline\": { \"type\":\"keyword\", \"doc_values\":false}," + + " \"responsetime\": { \"type\":\"float\", \"doc_values\":false}" + " }" + " }" + "}"); client().performRequest(createAirlineDataDisabledDocValues); - bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-doc-values\", \"_type\": \"response\", \"_id\": 1}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-doc-values\", \"_id\": 1}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:00:00Z\",\"airline\":\"AAA\",\"responsetime\":135.22}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-doc-values\", \"_type\": \"response\", \"_id\": 2}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-doc-values\", \"_id\": 2}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:59:00Z\",\"airline\":\"AAA\",\"responsetime\":541.76}\n"); // Create index with source = disabled, doc_values = enabled (except time), stored = true Request createAirlineDataDisabledSource = new Request("PUT", "/airline-data-disabled-source"); createAirlineDataDisabledSource.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"_source\":{\"enabled\":false}," - + " \"properties\": {" - + " \"time stamp\": { \"type\":\"date\", \"store\":true}," - + " \"airline\": { \"type\":\"keyword\", \"store\":true}," - + " \"responsetime\": { \"type\":\"float\", \"store\":true}" - + " }" + + " \"_source\":{\"enabled\":false}," + + " \"properties\": {" + + " \"time stamp\": { \"type\":\"date\", \"store\":true}," + + " \"airline\": { \"type\":\"keyword\", \"store\":true}," + + " \"responsetime\": { \"type\":\"float\", \"store\":true}" + " }" + " }" + "}"); - bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-source\", \"_type\": \"response\", \"_id\": 1}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-source\", \"_id\": 1}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:00:00Z\",\"airline\":\"AAA\",\"responsetime\":135.22}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-source\", \"_type\": \"response\", \"_id\": 2}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-disabled-source\", \"_id\": 2}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:59:00Z\",\"airline\":\"AAA\",\"responsetime\":541.76}\n"); // Create index with nested documents Request createAirlineDataNested = new Request("PUT", "/nested-data"); createAirlineDataNested.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"properties\": {" - + " \"time\": { \"type\":\"date\"}" - + " }" + + " \"properties\": {" + + " \"time\": { \"type\":\"date\"}" + " }" + " }" + "}"); client().performRequest(createAirlineDataNested); - bulk.append("{\"index\": {\"_index\": \"nested-data\", \"_type\": \"response\", \"_id\": 1}}\n"); + bulk.append("{\"index\": {\"_index\": \"nested-data\", \"_id\": 1}}\n"); bulk.append("{\"time\":\"2016-06-01T00:00:00Z\", \"responsetime\":{\"millis\":135.22}}\n"); - bulk.append("{\"index\": {\"_index\": \"nested-data\", \"_type\": \"response\", \"_id\": 2}}\n"); + bulk.append("{\"index\": {\"_index\": \"nested-data\", \"_id\": 2}}\n"); bulk.append("{\"time\":\"2016-06-01T01:59:00Z\",\"responsetime\":{\"millis\":222.0}}\n"); // Create index with multiple docs per time interval for aggregation testing Request createAirlineDataAggs = new Request("PUT", "/airline-data-aggs"); createAirlineDataAggs.setJsonEntity("{" + " \"mappings\": {" - + " \"response\": {" - + " \"properties\": {" - + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional - + " \"airline\": { \"type\":\"keyword\"}," - + " \"responsetime\": { \"type\":\"float\"}" - + " }" + + " \"properties\": {" + + " \"time stamp\": { \"type\":\"date\"}," // space in 'time stamp' is intentional + + " \"airline\": { \"type\":\"keyword\"}," + + " \"responsetime\": { \"type\":\"float\"}" + " }" + " }" + "}"); client().performRequest(createAirlineDataAggs); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 1}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 1}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:00:00Z\",\"airline\":\"AAA\",\"responsetime\":100.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 2}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 2}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:01:00Z\",\"airline\":\"AAA\",\"responsetime\":200.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 3}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 3}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:00:00Z\",\"airline\":\"BBB\",\"responsetime\":1000.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 4}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 4}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T00:01:00Z\",\"airline\":\"BBB\",\"responsetime\":2000.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 5}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 5}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:00:00Z\",\"airline\":\"AAA\",\"responsetime\":300.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 6}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 6}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:01:00Z\",\"airline\":\"AAA\",\"responsetime\":400.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 7}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 7}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:00:00Z\",\"airline\":\"BBB\",\"responsetime\":3000.0}\n"); - bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_type\": \"response\", \"_id\": 8}}\n"); + bulk.append("{\"index\": {\"_index\": \"airline-data-aggs\", \"_id\": 8}}\n"); bulk.append("{\"time stamp\":\"2016-06-01T01:01:00Z\",\"airline\":\"BBB\",\"responsetime\":4000.0}\n"); bulkIndex(bulk.toString()); @@ -240,18 +227,16 @@ private void addNetworkData(String index) throws IOException { Request createIndexRequest = new Request("PUT", index); createIndexRequest.setJsonEntity("{" + " \"mappings\": {" - + " \"doc\": {" - + " \"properties\": {" - + " \"timestamp\": { \"type\":\"date\"}," - + " \"host\": {" - + " \"type\":\"text\"," - + " \"fields\":{" - + " \"text\":{\"type\":\"text\"}," - + " \"keyword\":{\"type\":\"keyword\"}" - + " }" - + " }," - + " \"network_bytes_out\": { \"type\":\"long\"}" - + " }" + + " \"properties\": {" + + " \"timestamp\": { \"type\":\"date\"}," + + " \"host\": {" + + " \"type\":\"text\"," + + " \"fields\":{" + + " \"text\":{\"type\":\"text\"}," + + " \"keyword\":{\"type\":\"keyword\"}" + + " }" + + " }," + + " \"network_bytes_out\": { \"type\":\"long\"}" + " }" + " }" + "}");; @@ -262,11 +247,11 @@ private void addNetworkData(String index) throws IOException { Date date = new Date(1464739200735L); for (int i = 0; i < 120; i++) { long byteCount = randomNonNegativeLong(); - bulk.append("{\"index\": {\"_index\": \"").append(index).append("\", \"_type\": \"doc\"}}\n"); + bulk.append("{\"index\": {\"_index\": \"").append(index).append("\"}}\n"); bulk.append(String.format(Locale.ROOT, docTemplate, date.getTime(), "hostA", byteCount)).append('\n'); byteCount = randomNonNegativeLong(); - bulk.append("{\"index\": {\"_index\": \"").append(index).append("\", \"_type\": \"doc\"}}\n"); + bulk.append("{\"index\": {\"_index\": \"").append(index).append("\"}}\n"); bulk.append(String.format(Locale.ROOT, docTemplate, date.getTime(), "hostB", byteCount)).append('\n'); date = new Date(date.getTime() + 10_000); @@ -1197,7 +1182,6 @@ private void bulkIndex(String bulk) throws IOException { bulkRequest.setJsonEntity(bulk); bulkRequest.addParameter("refresh", "true"); bulkRequest.addParameter("pretty", null); - bulkRequest.setOptions(expectWarnings(RestBulkAction.TYPES_DEPRECATION_MESSAGE)); String bulkResponse = EntityUtils.toString(client().performRequest(bulkRequest).getEntity()); assertThat(bulkResponse, not(containsString("\"errors\": false"))); } diff --git a/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java b/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java index c895ab2d4f5d1..1453f59ed43e4 100644 --- a/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java +++ b/x-pack/plugin/ml/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/ml/transforms/PainlessDomainSplitIT.java @@ -262,8 +262,8 @@ public void testHRDSplit() throws Exception { .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0); - createIndex("painless", settings.build(), "\"_doc\": { \"properties\": { \"domain\": { \"type\": \"keyword\" }," + - "\"time\": { \"type\": \"date\" } } }"); + createIndex("painless", settings.build(), "\"properties\": { \"domain\": { \"type\": \"keyword\" }," + + "\"time\": { \"type\": \"date\" } }"); // Index some data DateTime baseTime = new DateTime().minusYears(1); diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/TemplateHttpResource.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/TemplateHttpResource.java index 5e6ed790b1a54..28bca87b0a096 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/TemplateHttpResource.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/TemplateHttpResource.java @@ -17,9 +17,14 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils; +import java.util.Collections; +import java.util.Map; import java.util.Objects; +import java.util.TreeMap; import java.util.function.Supplier; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; + /** * {@code TemplateHttpResource}s allow the checking and uploading of templates to a remote cluster. *

@@ -31,6 +36,15 @@ public class TemplateHttpResource extends PublishableHttpResource { private static final Logger logger = LogManager.getLogger(TemplateHttpResource.class); + public static final Map PARAMETERS; + + static { + Map parameters = new TreeMap<>(); + parameters.put("filter_path", FILTER_PATH_RESOURCE_VERSION); + parameters.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); + PARAMETERS = Collections.unmodifiableMap(parameters); + } + /** * The name of the template that is sent to the remote cluster. */ @@ -50,7 +64,7 @@ public class TemplateHttpResource extends PublishableHttpResource { */ public TemplateHttpResource(final String resourceOwnerName, @Nullable final TimeValue masterTimeout, final String templateName, final Supplier template) { - super(resourceOwnerName, masterTimeout, PublishableHttpResource.RESOURCE_VERSION_PARAMETERS); + super(resourceOwnerName, masterTimeout, PARAMETERS); this.templateName = Objects.requireNonNull(templateName); this.template = Objects.requireNonNull(template); diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/AbstractPublishableHttpResourceTestCase.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/AbstractPublishableHttpResourceTestCase.java index 39f6c573fc403..798053d59be37 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/AbstractPublishableHttpResourceTestCase.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/AbstractPublishableHttpResourceTestCase.java @@ -30,6 +30,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.elasticsearch.xpack.monitoring.exporter.http.AsyncHttpResourceHelper.mockBooleanActionListener; import static org.elasticsearch.xpack.monitoring.exporter.http.AsyncHttpResourceHelper.whenPerformRequestAsyncWith; import static org.elasticsearch.xpack.monitoring.exporter.http.PublishableHttpResource.GET_DOES_NOT_EXIST; @@ -212,6 +213,11 @@ protected void assertVersionParameters(final PublishableHttpResource resource) { } assertThat(parameters.remove("filter_path"), is("*.version")); + + if (parameters.containsKey(INCLUDE_TYPE_NAME_PARAMETER)) { + assertThat(parameters.remove(INCLUDE_TYPE_NAME_PARAMETER), is("true")); + } + assertThat(parameters.isEmpty(), is(true)); } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java index 1f9ab90e86542..a6cddcf35d370 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java @@ -57,6 +57,7 @@ import java.util.stream.Collectors; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.LAST_UPDATED_VERSION; import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION; import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.indexName; @@ -273,17 +274,18 @@ public void testHostChangeReChecksTemplate() throws Exception { assertMonitorVersion(secondWebServer); + String resourcePrefix = "/_template/"; for (Tuple template : monitoringTemplates(includeOldTemplates)) { MockRequest recordedRequest = secondWebServer.takeRequest(); assertThat(recordedRequest.getMethod(), equalTo("GET")); - assertThat(recordedRequest.getUri().getPath(), equalTo("/_template/" + template.v1())); - assertThat(recordedRequest.getUri().getQuery(), equalTo(resourceVersionQueryString())); + assertThat(recordedRequest.getUri().getPath(), equalTo(resourcePrefix + template.v1())); + assertMonitorVersionQueryString(resourcePrefix, recordedRequest.getUri().getQuery()); if (missingTemplate.equals(template.v1())) { recordedRequest = secondWebServer.takeRequest(); assertThat(recordedRequest.getMethod(), equalTo("PUT")); - assertThat(recordedRequest.getUri().getPath(), equalTo("/_template/" + template.v1())); - assertThat(recordedRequest.getUri().getQuery(), equalTo(resourceVersionQueryString())); + assertThat(recordedRequest.getUri().getPath(), equalTo(resourcePrefix + template.v1())); + assertMonitorVersionQueryString(resourcePrefix, recordedRequest.getUri().getQuery()); assertThat(recordedRequest.getBody(), equalTo(template.v2())); } } @@ -457,7 +459,7 @@ private void assertMonitorVersionResource(final MockWebServer webServer, final b assertThat(getRequest.getMethod(), equalTo("GET")); assertThat(getRequest.getUri().getPath(), equalTo(pathPrefix + resourcePrefix + resource.v1())); - assertThat(getRequest.getUri().getQuery(), equalTo(resourceVersionQueryString())); + assertMonitorVersionQueryString(resourcePrefix, getRequest.getUri().getQuery()); assertHeaders(getRequest, customHeaders); if (alreadyExists == false) { @@ -465,13 +467,21 @@ private void assertMonitorVersionResource(final MockWebServer webServer, final b assertThat(putRequest.getMethod(), equalTo("PUT")); assertThat(putRequest.getUri().getPath(), equalTo(pathPrefix + resourcePrefix + resource.v1())); - assertThat(putRequest.getUri().getQuery(), equalTo(resourceVersionQueryString())); + assertMonitorVersionQueryString(resourcePrefix, getRequest.getUri().getQuery()); assertThat(putRequest.getBody(), equalTo(resource.v2())); assertHeaders(putRequest, customHeaders); } } } + private void assertMonitorVersionQueryString(String resourcePrefix, String query) { + if (resourcePrefix.startsWith("/_template")) { + assertThat(query, equalTo(INCLUDE_TYPE_NAME_PARAMETER + "=true&" + resourceVersionQueryString())); + } else { + assertThat(query, equalTo(resourceVersionQueryString())); + } + } + private void assertMonitorWatches(final MockWebServer webServer, final boolean remoteClusterAllowsWatcher, final boolean currentLicenseAllowsWatcher, final boolean alreadyExists, diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java index 8b96a780d1a8c..7305b2f1902cf 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java @@ -436,7 +436,7 @@ private void assertUserExecutes(String user, String action, String index, boolea // indexing a document to have the mapping available, and wait for green state to make sure index is created assertAccessIsAllowed("admin", "PUT", "/" + index + "/foo/1", jsonDoc); assertNoTimeout(client().admin().cluster().prepareHealth(index).setWaitForGreenStatus().get()); - assertAccessIsAllowed(user, "GET", "/" + index + "/_mapping/foo/field/name"); + assertAccessIsAllowed(user, "GET", "/" + index + "/_mapping/field/name"); assertAccessIsAllowed(user, "GET", "/" + index + "/_settings"); } else { assertAccessIsDenied(user, "DELETE", "/" + index); @@ -449,7 +449,7 @@ private void assertUserExecutes(String user, String action, String index, boolea assertAccessIsDenied(user, "POST", "/" + index + "/_close"); assertAccessIsDenied(user, "POST", "/" + index + "/_open"); assertAccessIsDenied(user, "POST", "/" + index + "/_cache/clear"); - assertAccessIsDenied(user, "GET", "/" + index + "/_mapping/foo/field/name"); + assertAccessIsDenied(user, "GET", "/" + index + "/_mapping/field/name"); assertAccessIsDenied(user, "GET", "/" + index + "/_settings"); } break; diff --git a/x-pack/plugin/sql/qa/single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/JdbcShardFailureIT.java b/x-pack/plugin/sql/qa/single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/JdbcShardFailureIT.java index f7c490cc8b490..19e16d1de2edb 100644 --- a/x-pack/plugin/sql/qa/single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/JdbcShardFailureIT.java +++ b/x-pack/plugin/sql/qa/single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/JdbcShardFailureIT.java @@ -20,12 +20,12 @@ public class JdbcShardFailureIT extends JdbcIntegrationTestCase { @Before public void createTestIndex() throws IOException { Request createTest1 = new Request("PUT", "/test1"); - String body1 = "{\"aliases\":{\"test\":{}}, \"mappings\": {\"doc\": {\"properties\": {\"test_field\":{\"type\":\"integer\"}}}}}"; + String body1 = "{\"aliases\":{\"test\":{}}, \"mappings\": {\"properties\": {\"test_field\":{\"type\":\"integer\"}}}}"; createTest1.setJsonEntity(body1); client().performRequest(createTest1); Request createTest2 = new Request("PUT", "/test2"); - String body2 = "{\"aliases\":{\"test\":{}}, \"mappings\": {\"doc\": {\"properties\": {\"test_field\":{\"type\":\"integer\"}}}}," + + String body2 = "{\"aliases\":{\"test\":{}}, \"mappings\": {\"properties\": {\"test_field\":{\"type\":\"integer\"}}}," + "\"settings\": {\"index.routing.allocation.include.node\": \"nowhere\"}}"; createTest2.setJsonEntity(body2); createTest2.addParameter("timeout", "100ms"); diff --git a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java index 3bb710c998290..3d5308d148d57 100644 --- a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java +++ b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java @@ -1273,12 +1273,8 @@ private void createIndex(String index) throws Exception { createIndex.endObject(); createIndex.startObject("mappings"); { - createIndex.startObject("_doc"); - { - createIndex.startObject("properties"); - {} - createIndex.endObject(); - } + createIndex.startObject("properties"); + {} createIndex.endObject(); } createIndex.endObject().endObject(); @@ -1287,7 +1283,7 @@ private void createIndex(String index) throws Exception { } private void updateMapping(String index, CheckedConsumer body) throws Exception { - Request request = new Request("PUT", "/" + index + "/_mapping/_doc"); + Request request = new Request("PUT", "/" + index + "/_mapping"); XContentBuilder updateMapping = JsonXContent.contentBuilder().startObject(); updateMapping.startObject("properties"); { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml index b230e12589f53..91ba0ae17ce0d 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml @@ -42,10 +42,10 @@ setup: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser indices.get_field_mapping: + include_type_name: false index: .ml-anomalies-shared - type: doc fields: new_field - - match: {\.ml-anomalies-shared.mappings.doc.new_field.mapping.new_field.type: keyword} + - match: {\.ml-anomalies-shared.mappings.new_field.mapping.new_field.type: keyword} --- "Test _meta exists when two jobs share an index": @@ -75,8 +75,9 @@ setup: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser indices.get_mapping: + include_type_name: false index: .ml-anomalies-shared - - is_true: \.ml-anomalies-shared.mappings.doc._meta.version + - is_true: \.ml-anomalies-shared.mappings._meta.version - do: ml.put_job: @@ -103,5 +104,6 @@ setup: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser indices.get_mapping: + include_type_name: false index: .ml-anomalies-shared - - is_true: \.ml-anomalies-shared.mappings.doc._meta.version + - is_true: \.ml-anomalies-shared.mappings._meta.version