From 6c1b2537123e049b7d05fce027ea405262a5cf3f Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Tue, 24 May 2022 16:05:55 -0700 Subject: [PATCH 1/6] Removing type mappings for 2.0 Signed-off-by: Vacha Shah --- DEVELOPER_GUIDE.md | 2 +- api_generator/rest_specs/bulk.json | 17 - api_generator/rest_specs/count.json | 21 - api_generator/rest_specs/create.json | 26 - api_generator/rest_specs/delete.json | 25 - api_generator/rest_specs/delete_by_query.json | 19 - api_generator/rest_specs/exists.json | 25 - api_generator/rest_specs/exists_source.json | 25 - api_generator/rest_specs/explain.json | 26 - api_generator/rest_specs/get.json | 25 - api_generator/rest_specs/get_source.json | 25 - api_generator/rest_specs/index.json | 47 -- .../rest_specs/indices.exists_type.json | 59 --- .../rest_specs/indices.flush_synced.json | 66 --- .../rest_specs/indices.get_field_mapping.json | 46 -- .../rest_specs/indices.get_mapping.json | 38 -- .../rest_specs/indices.put_mapping.json | 124 ----- .../rest_specs/indices.validate_query.json | 22 - api_generator/rest_specs/mget.json | 22 - api_generator/rest_specs/msearch.json | 18 - .../rest_specs/msearch_template.json | 18 - api_generator/rest_specs/mtermvectors.json | 19 - api_generator/rest_specs/search.json | 18 - api_generator/rest_specs/search_template.json | 18 - api_generator/rest_specs/termvectors.json | 44 -- api_generator/rest_specs/update.json | 25 - api_generator/rest_specs/update_by_query.json | 19 - .../generator/code_gen/url/enum_builder.rs | 19 +- opensearch/src/generated/root.rs | 367 --------------- opensearch/src/indices.rs | 443 ------------------ opensearch/src/lib.rs | 8 +- opensearch/src/root/mod.rs | 367 --------------- yaml_test_runner/src/step/do.rs | 4 - 33 files changed, 4 insertions(+), 2043 deletions(-) delete mode 100644 api_generator/rest_specs/indices.exists_type.json delete mode 100644 api_generator/rest_specs/indices.flush_synced.json diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 39af6fd3..9b6f150e 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -130,7 +130,7 @@ can be `to_string()`'ed and written to disk, and this is used to create much of 1. Generate as much of the client as feasible from the REST API specs The REST API specs contain information about - - the URL parts e.g. `{index}/{type}/_search` and variants + - the URL parts e.g. `{index}/_search` and variants - accepted HTTP methods e.g. `GET`, `POST` - the URL query string parameters - whether the API accepts a body diff --git a/api_generator/rest_specs/bulk.json b/api_generator/rest_specs/bulk.json index 133153a2..84e747ba 100644 --- a/api_generator/rest_specs/bulk.json +++ b/api_generator/rest_specs/bulk.json @@ -31,23 +31,6 @@ "description":"Default index for items which don't provide one" } } - }, - { - "path":"/{index}/{type}/_bulk", - "methods":[ - "POST", - "PUT" - ], - "parts":{ - "index":{ - "type":"string", - "description":"Default index for items which don't provide one" - }, - "type":{ - "type":"string", - "description":"Default document type for items which don't provide one" - } - } } ] }, diff --git a/api_generator/rest_specs/count.json b/api_generator/rest_specs/count.json index 84ac0ff4..c5cc4f0f 100644 --- a/api_generator/rest_specs/count.json +++ b/api_generator/rest_specs/count.json @@ -32,27 +32,6 @@ "description":"A comma-separated list of indices to restrict the results" } } - }, - { - "path":"/{index}/{type}/_count", - "methods":[ - "POST", - "GET" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of indices to restrict the results" - }, - "type": { - "type" : "list", - "description" : "A comma-separated list of types to restrict the results" - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/create.json b/api_generator/rest_specs/create.json index a71a0e74..8b71bed5 100644 --- a/api_generator/rest_specs/create.json +++ b/api_generator/rest_specs/create.json @@ -28,32 +28,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}/_create", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "id":{ - "type":"string", - "description":"Document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/delete.json b/api_generator/rest_specs/delete.json index 511c7368..f972b5fe 100644 --- a/api_generator/rest_specs/delete.json +++ b/api_generator/rest_specs/delete.json @@ -26,31 +26,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}", - "methods":[ - "DELETE" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/delete_by_query.json b/api_generator/rest_specs/delete_by_query.json index 637da1aa..78facddb 100644 --- a/api_generator/rest_specs/delete_by_query.json +++ b/api_generator/rest_specs/delete_by_query.json @@ -23,25 +23,6 @@ "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path" : "/{index}/{type}/_delete_by_query", - "methods": ["POST"], - "parts": { - "index": { - "required": true, - "type": "list", - "description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" - }, - "type": { - "type": "list", - "description": "A comma-separated list of document types to search; leave empty to perform the operation on all types" - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/exists.json b/api_generator/rest_specs/exists.json index ac3532b8..f3b54cac 100644 --- a/api_generator/rest_specs/exists.json +++ b/api_generator/rest_specs/exists.json @@ -26,31 +26,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}", - "methods":[ - "HEAD" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document (use `_all` to fetch the first document matching the ID across all types)", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/exists_source.json b/api_generator/rest_specs/exists_source.json index 86e50266..5b932c56 100644 --- a/api_generator/rest_specs/exists_source.json +++ b/api_generator/rest_specs/exists_source.json @@ -26,31 +26,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}/_source", - "methods":[ - "HEAD" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document; deprecated and optional starting with 7.0", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/explain.json b/api_generator/rest_specs/explain.json index c3fe77c8..ea817022 100644 --- a/api_generator/rest_specs/explain.json +++ b/api_generator/rest_specs/explain.json @@ -28,32 +28,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}/_explain", - "methods":[ - "GET", - "POST" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/get.json b/api_generator/rest_specs/get.json index 6208fdbe..3e7d1de5 100644 --- a/api_generator/rest_specs/get.json +++ b/api_generator/rest_specs/get.json @@ -26,31 +26,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}", - "methods":[ - "GET" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document (use `_all` to fetch the first document matching the ID across all types)", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/get_source.json b/api_generator/rest_specs/get_source.json index 22742c89..76dc2a1f 100644 --- a/api_generator/rest_specs/get_source.json +++ b/api_generator/rest_specs/get_source.json @@ -26,31 +26,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}/_source", - "methods":[ - "GET" - ], - "parts":{ - "id":{ - "type":"string", - "description":"The document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document; deprecated and optional starting with 7.0", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/index.json b/api_generator/rest_specs/index.json index 3a345edf..cde3b3a7 100644 --- a/api_generator/rest_specs/index.json +++ b/api_generator/rest_specs/index.json @@ -40,53 +40,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}", - "methods":[ - "POST" - ], - "parts":{ - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/{type}/{id}", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "id":{ - "type":"string", - "description":"Document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/indices.exists_type.json b/api_generator/rest_specs/indices.exists_type.json deleted file mode 100644 index 4c79b3df..00000000 --- a/api_generator/rest_specs/indices.exists_type.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "indices.exists_type":{ - "documentation":{ - "url":"https://opensearch.org/docs/", - "description":"Returns information about whether a particular document type exists. (DEPRECATED)" - }, - "stability":"stable", - "visibility":"public", - "headers":{ - "accept": [ "application/json"] - }, - "url":{ - "paths":[ - { - "path":"/{index}/_mapping/{type}", - "methods":[ - "HEAD" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names; use `_all` to check the types across all indices" - }, - "type":{ - "type":"list", - "description":"A comma-separated list of document types to check" - } - } - } - ] - }, - "params":{ - "ignore_unavailable":{ - "type":"boolean", - "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" - }, - "allow_no_indices":{ - "type":"boolean", - "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" - }, - "expand_wildcards":{ - "type":"enum", - "options":[ - "open", - "closed", - "hidden", - "none", - "all" - ], - "default":"open", - "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." - }, - "local":{ - "type":"boolean", - "description":"Return local information, do not retrieve the state from master node (default: false)" - } - } - } -} diff --git a/api_generator/rest_specs/indices.flush_synced.json b/api_generator/rest_specs/indices.flush_synced.json deleted file mode 100644 index 852d86ac..00000000 --- a/api_generator/rest_specs/indices.flush_synced.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "indices.flush_synced":{ - "documentation":{ - "url":"https://opensearch.org/docs/", - "description":"Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead" - }, - "stability":"stable", - "visibility" : "public", - "headers":{ - "accept": [ "application/json"] - }, - "url":{ - "paths":[ - { - "path":"/_flush/synced", - "methods":[ - "POST", - "GET" - ], - "deprecated":{ - "version":"7.6.0", - "description":"Synced flush is deprecated and will be removed in 8.0. Use flush instead." - } - }, - { - "path":"/{index}/_flush/synced", - "methods":[ - "POST", - "GET" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names; use `_all` or empty string for all indices" - } - }, - "deprecated":{ - "version":"7.6.0", - "description":"Synced flush is deprecated and will be removed in 8.0. Use flush instead." - } - } - ] - }, - "params":{ - "ignore_unavailable":{ - "type":"boolean", - "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" - }, - "allow_no_indices":{ - "type":"boolean", - "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" - }, - "expand_wildcards":{ - "type":"enum", - "options":[ - "open", - "closed", - "none", - "all" - ], - "default":"open", - "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." - } - } - } -} diff --git a/api_generator/rest_specs/indices.get_field_mapping.json b/api_generator/rest_specs/indices.get_field_mapping.json index f8dcbdca..eff35aad 100644 --- a/api_generator/rest_specs/indices.get_field_mapping.json +++ b/api_generator/rest_specs/indices.get_field_mapping.json @@ -38,52 +38,6 @@ "description":"A comma-separated list of fields" } } - }, - { - "path":"/_mapping/{type}/field/{fields}", - "methods":[ - "GET" - ], - "parts":{ - "type":{ - "type":"list", - "description":"A comma-separated list of document types", - "deprecated":true - }, - "fields":{ - "type":"list", - "description":"A comma-separated list of fields" - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/_mapping/{type}/field/{fields}", - "methods":[ - "GET" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names" - }, - "type":{ - "type":"list", - "description":"A comma-separated list of document types", - "deprecated":true - }, - "fields":{ - "type":"list", - "description":"A comma-separated list of fields" - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/indices.get_mapping.json b/api_generator/rest_specs/indices.get_mapping.json index 7412d94d..285c22e1 100644 --- a/api_generator/rest_specs/indices.get_mapping.json +++ b/api_generator/rest_specs/indices.get_mapping.json @@ -28,44 +28,6 @@ "description":"A comma-separated list of index names" } } - }, - { - "path":"/_mapping/{type}", - "methods":[ - "GET" - ], - "parts":{ - "type":{ - "type":"list", - "description":"A comma-separated list of document types", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/_mapping/{type}", - "methods":[ - "GET" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names" - }, - "type":{ - "type":"list", - "description":"A comma-separated list of document types", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/indices.put_mapping.json b/api_generator/rest_specs/indices.put_mapping.json index 596f355f..13868cf3 100644 --- a/api_generator/rest_specs/indices.put_mapping.json +++ b/api_generator/rest_specs/indices.put_mapping.json @@ -25,112 +25,6 @@ } } }, - { - "path":"/{index}/{type}/_mapping", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." - }, - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/_mapping/{type}", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." - }, - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/{type}/_mappings", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." - }, - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/{index}/_mappings/{type}", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." - }, - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, - { - "path":"/_mappings/{type}", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } - }, { "path":"/{index}/_mappings", "methods":[ @@ -147,24 +41,6 @@ "version":"7.0.0", "description":"The plural mappings is accepted but only /_mapping is documented" } - }, - { - "path":"/_mapping/{type}", - "methods":[ - "PUT", - "POST" - ], - "parts":{ - "type":{ - "type":"string", - "description":"The name of the document type", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/indices.validate_query.json b/api_generator/rest_specs/indices.validate_query.json index 94c70751..69083a24 100644 --- a/api_generator/rest_specs/indices.validate_query.json +++ b/api_generator/rest_specs/indices.validate_query.json @@ -31,28 +31,6 @@ "description":"A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path":"/{index}/{type}/_validate/query", - "methods":[ - "GET", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices" - }, - "type":{ - "type":"list", - "description":"A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/mget.json b/api_generator/rest_specs/mget.json index 2e754a7f..9226e330 100644 --- a/api_generator/rest_specs/mget.json +++ b/api_generator/rest_specs/mget.json @@ -31,28 +31,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/_mget", - "methods":[ - "GET", - "POST" - ], - "parts":{ - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/msearch.json b/api_generator/rest_specs/msearch.json index b470da9f..09488ee7 100644 --- a/api_generator/rest_specs/msearch.json +++ b/api_generator/rest_specs/msearch.json @@ -31,24 +31,6 @@ "description":"A comma-separated list of index names to use as default" } } - }, - { - "path" : "/{index}/{type}/_msearch", - "methods": ["GET", "POST"], - "parts": { - "index": { - "type" : "list", - "description" : "A comma-separated list of index names to use as default" - }, - "type": { - "type" : "list", - "description" : "A comma-separated list of document types to use as default" - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/msearch_template.json b/api_generator/rest_specs/msearch_template.json index 77686bce..e8152ed1 100644 --- a/api_generator/rest_specs/msearch_template.json +++ b/api_generator/rest_specs/msearch_template.json @@ -31,24 +31,6 @@ "description":"A comma-separated list of index names to use as default" } } - }, - { - "path" : "/{index}/{type}/_msearch/template", - "methods": ["GET", "POST"], - "parts": { - "index": { - "type" : "list", - "description" : "A comma-separated list of index names to use as default" - }, - "type": { - "type" : "list", - "description" : "A comma-separated list of document types to use as default" - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/mtermvectors.json b/api_generator/rest_specs/mtermvectors.json index 716d8edb..81e2039c 100644 --- a/api_generator/rest_specs/mtermvectors.json +++ b/api_generator/rest_specs/mtermvectors.json @@ -31,25 +31,6 @@ "description":"The index in which the document resides." } } - }, - { - "path" : "/{index}/{type}/_mtermvectors", - "methods" : ["GET", "POST"], - "parts" : { - "index" : { - "type" : "string", - "description" : "The index in which the document resides." - }, - "type" : { - "type" : "string", - "description" : "The type of the document." - } - }, - "deprecated":{ - "version" : "7.0.0", - - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/search.json b/api_generator/rest_specs/search.json index f997b9ef..8998e076 100644 --- a/api_generator/rest_specs/search.json +++ b/api_generator/rest_specs/search.json @@ -31,24 +31,6 @@ "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path" : "/{index}/{type}/_search", - "methods": ["GET", "POST"], - "parts": { - "index": { - "type" : "list", - "description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" - }, - "type": { - "type": "list", - "description": "A comma-separated list of document types to search; leave empty to perform the operation on all types" - } - }, - "deprecated" : { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/search_template.json b/api_generator/rest_specs/search_template.json index 3e9a2cb0..50fc93f9 100644 --- a/api_generator/rest_specs/search_template.json +++ b/api_generator/rest_specs/search_template.json @@ -31,24 +31,6 @@ "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path" : "/{index}/{type}/_search/template", - "methods": ["GET", "POST"], - "parts": { - "index": { - "type" : "list", - "description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" - }, - "type": { - "type" : "list", - "description" : "A comma-separated list of document types to search; leave empty to perform the operation on all types" - } - }, - "deprecated" : { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/termvectors.json b/api_generator/rest_specs/termvectors.json index 5cc375b7..2dac20ef 100644 --- a/api_generator/rest_specs/termvectors.json +++ b/api_generator/rest_specs/termvectors.json @@ -41,50 +41,6 @@ "description":"The index in which the document resides." } } - }, - { - "path" : "/{index}/{type}/{id}/_termvectors", - "methods" : ["GET", "POST"], - "parts" : { - "index" : { - "type" : "string", - "description" : "The index in which the document resides.", - "required" : true - }, - "type" : { - "type" : "string", - "description" : "The type of the document.", - "required" : false - }, - "id" : { - "type" : "string", - "description" : "The id of the document, when not specified a doc param should be supplied." - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } - }, - { - "path" : "/{index}/{type}/_termvectors", - "methods" : ["GET", "POST"], - "parts" : { - "index" : { - "type" : "string", - "description" : "The index in which the document resides.", - "required" : true - }, - "type" : { - "type" : "string", - "description" : "The type of the document.", - "required" : false - } - }, - "deprecated": { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/update.json b/api_generator/rest_specs/update.json index e97d0ea9..8159dcc0 100644 --- a/api_generator/rest_specs/update.json +++ b/api_generator/rest_specs/update.json @@ -27,31 +27,6 @@ "description":"The name of the index" } } - }, - { - "path":"/{index}/{type}/{id}/_update", - "methods":[ - "POST" - ], - "parts":{ - "id":{ - "type":"string", - "description":"Document ID" - }, - "index":{ - "type":"string", - "description":"The name of the index" - }, - "type":{ - "type":"string", - "description":"The type of the document", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/rest_specs/update_by_query.json b/api_generator/rest_specs/update_by_query.json index 72a2fbc1..2e693e24 100644 --- a/api_generator/rest_specs/update_by_query.json +++ b/api_generator/rest_specs/update_by_query.json @@ -23,25 +23,6 @@ "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path" : "/{index}/{type}/_update_by_query", - "methods": ["POST"], - "parts": { - "index": { - "required": true, - "type": "list", - "description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" - }, - "type": { - "type": "list", - "description": "A comma-separated list of document types to search; leave empty to perform the operation on all types" - } - }, - "deprecated" : { - "version" : "7.0.0", - "description" : "Specifying types in urls has been deprecated" - } } ] }, diff --git a/api_generator/src/generator/code_gen/url/enum_builder.rs b/api_generator/src/generator/code_gen/url/enum_builder.rs index 88986a3f..9e0d9085 100644 --- a/api_generator/src/generator/code_gen/url/enum_builder.rs +++ b/api_generator/src/generator/code_gen/url/enum_builder.rs @@ -352,7 +352,7 @@ mod tests { deprecated: None, }, Path { - path: PathString("/{index}/{type}/_search".to_string()), + path: PathString("/{index}/_search".to_string()), methods: vec![HttpMethod::Get, HttpMethod::Post], parts: { let mut map = BTreeMap::new(); @@ -397,9 +397,7 @@ mod tests { #[doc = "No parts"] None, #[doc = "Index"] - Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), + Index(&'b [&'b str]) } ); @@ -420,19 +418,6 @@ mod tests { p.push_str("/_search"); p.into() } - SearchParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_search"); - p.into() - } } } } diff --git a/opensearch/src/generated/root.rs b/opensearch/src/generated/root.rs index d70567f3..2b1bcb2b 100644 --- a/opensearch/src/generated/root.rs +++ b/opensearch/src/generated/root.rs @@ -44,8 +44,6 @@ pub enum BulkParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> BulkParts<'b> { #[doc = "Builds a relative URL path to the Bulk API"] @@ -61,18 +59,6 @@ impl<'b> BulkParts<'b> { p.push_str("/_bulk"); p.into() } - BulkParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_bulk"); - p.into() - } } } } @@ -454,8 +440,6 @@ pub enum CountParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> CountParts<'b> { #[doc = "Builds a relative URL path to the Count API"] @@ -472,20 +456,6 @@ impl<'b> CountParts<'b> { p.push_str("/_count"); p.into() } - CountParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(9usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_count"); - p.into() - } } } } @@ -760,8 +730,6 @@ where pub enum CreateParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> CreateParts<'b> { #[doc = "Builds a relative URL path to the Create API"] @@ -778,23 +746,6 @@ impl<'b> CreateParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - CreateParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_create"); - p.into() - } } } } @@ -994,8 +945,6 @@ where pub enum DeleteParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> DeleteParts<'b> { #[doc = "Builds a relative URL path to the Delete API"] @@ -1012,22 +961,6 @@ impl<'b> DeleteParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - DeleteParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -1206,8 +1139,6 @@ impl<'a, 'b> Delete<'a, 'b> { pub enum DeleteByQueryParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> DeleteByQueryParts<'b> { #[doc = "Builds a relative URL path to the Delete By Query API"] @@ -1223,20 +1154,6 @@ impl<'b> DeleteByQueryParts<'b> { p.push_str("/_delete_by_query"); p.into() } - DeleteByQueryParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_delete_by_query"); - p.into() - } } } } @@ -1992,8 +1909,6 @@ impl<'a, 'b> DeleteScript<'a, 'b> { pub enum ExistsParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExistsParts<'b> { #[doc = "Builds a relative URL path to the Exists API"] @@ -2010,22 +1925,6 @@ impl<'b> ExistsParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExistsParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -2226,8 +2125,6 @@ impl<'a, 'b> Exists<'a, 'b> { pub enum ExistsSourceParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExistsSourceParts<'b> { #[doc = "Builds a relative URL path to the Exists Source API"] @@ -2244,23 +2141,6 @@ impl<'b> ExistsSourceParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExistsSourceParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_source"); - p.into() - } } } } @@ -2451,8 +2331,6 @@ impl<'a, 'b> ExistsSource<'a, 'b> { pub enum ExplainParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExplainParts<'b> { #[doc = "Builds a relative URL path to the Explain API"] @@ -2469,23 +2347,6 @@ impl<'b> ExplainParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExplainParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 12usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_explain"); - p.into() - } } } } @@ -2944,8 +2805,6 @@ where pub enum GetParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> GetParts<'b> { #[doc = "Builds a relative URL path to the Get API"] @@ -2962,22 +2821,6 @@ impl<'b> GetParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - GetParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -3305,8 +3148,6 @@ impl<'a, 'b> GetScript<'a, 'b> { pub enum GetSourceParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> GetSourceParts<'b> { #[doc = "Builds a relative URL path to the Get Source API"] @@ -3323,23 +3164,6 @@ impl<'b> GetSourceParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - GetSourceParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_source"); - p.into() - } } } } @@ -3532,10 +3356,6 @@ pub enum IndexParts<'b> { IndexId(&'b str, &'b str), #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> IndexParts<'b> { #[doc = "Builds a relative URL path to the Index API"] @@ -3561,33 +3381,6 @@ impl<'b> IndexParts<'b> { p.push_str("/_doc"); p.into() } - IndexParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(2usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } - IndexParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -3941,8 +3734,6 @@ pub enum MgetParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> MgetParts<'b> { #[doc = "Builds a relative URL path to the Mget API"] @@ -3958,18 +3749,6 @@ impl<'b> MgetParts<'b> { p.push_str("/_mget"); p.into() } - MgetParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mget"); - p.into() - } } } } @@ -4188,8 +3967,6 @@ pub enum MsearchParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> MsearchParts<'b> { #[doc = "Builds a relative URL path to the Msearch API"] @@ -4206,20 +3983,6 @@ impl<'b> MsearchParts<'b> { p.push_str("/_msearch"); p.into() } - MsearchParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_msearch"); - p.into() - } } } } @@ -4424,8 +4187,6 @@ pub enum MsearchTemplateParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> MsearchTemplateParts<'b> { #[doc = "Builds a relative URL path to the Msearch Template API"] @@ -4442,20 +4203,6 @@ impl<'b> MsearchTemplateParts<'b> { p.push_str("/_msearch/template"); p.into() } - MsearchTemplateParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(20usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_msearch/template"); - p.into() - } } } } @@ -4640,8 +4387,6 @@ pub enum MtermvectorsParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> MtermvectorsParts<'b> { #[doc = "Builds a relative URL path to the Mtermvectors API"] @@ -4657,18 +4402,6 @@ impl<'b> MtermvectorsParts<'b> { p.push_str("/_mtermvectors"); p.into() } - MtermvectorsParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mtermvectors"); - p.into() - } } } } @@ -5915,8 +5648,6 @@ pub enum SearchParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> SearchParts<'b> { #[doc = "Builds a relative URL path to the Search API"] @@ -5933,20 +5664,6 @@ impl<'b> SearchParts<'b> { p.push_str("/_search"); p.into() } - SearchParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_search"); - p.into() - } } } } @@ -6721,8 +6438,6 @@ pub enum SearchTemplateParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> SearchTemplateParts<'b> { #[doc = "Builds a relative URL path to the Search Template API"] @@ -6739,20 +6454,6 @@ impl<'b> SearchTemplateParts<'b> { p.push_str("/_search/template"); p.into() } - SearchTemplateParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_search/template"); - p.into() - } } } } @@ -7019,10 +6720,6 @@ pub enum TermvectorsParts<'b> { IndexId(&'b str, &'b str), #[doc = "Index"] Index(&'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> TermvectorsParts<'b> { #[doc = "Builds a relative URL path to the Termvectors API"] @@ -7048,35 +6745,6 @@ impl<'b> TermvectorsParts<'b> { p.push_str("/_termvectors"); p.into() } - TermvectorsParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 16usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_termvectors"); - p.into() - } - TermvectorsParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_termvectors"); - p.into() - } } } } @@ -7320,8 +6988,6 @@ where pub enum UpdateParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> UpdateParts<'b> { #[doc = "Builds a relative URL path to the Update API"] @@ -7338,23 +7004,6 @@ impl<'b> UpdateParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - UpdateParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_update"); - p.into() - } } } } @@ -7607,8 +7256,6 @@ where pub enum UpdateByQueryParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> UpdateByQueryParts<'b> { #[doc = "Builds a relative URL path to the Update By Query API"] @@ -7624,20 +7271,6 @@ impl<'b> UpdateByQueryParts<'b> { p.push_str("/_update_by_query"); p.into() } - UpdateByQueryParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_update_by_query"); - p.into() - } } } } diff --git a/opensearch/src/indices.rs b/opensearch/src/indices.rs index b5995531..ea04ddd4 100644 --- a/opensearch/src/indices.rs +++ b/opensearch/src/indices.rs @@ -2550,167 +2550,6 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Exists Type API"] -pub enum IndicesExistsTypeParts<'b> { - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), -} -impl<'b> IndicesExistsTypeParts<'b> { - #[doc = "Builds a relative URL path to the Indices Exists Type API"] - pub fn url(self) -> Cow<'static, str> { - match self { - IndicesExistsTypeParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } - } - } -} -#[doc = "Builder for the [Indices Exists Type API](https://opensearch.org/docs/)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] -#[derive(Clone, Debug)] -pub struct IndicesExistsType<'a, 'b> { - transport: &'a Transport, - parts: IndicesExistsTypeParts<'b>, - allow_no_indices: Option, - error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, - filter_path: Option<&'b [&'b str]>, - headers: HeaderMap, - human: Option, - ignore_unavailable: Option, - local: Option, - pretty: Option, - request_timeout: Option, - source: Option<&'b str>, -} -impl<'a, 'b> IndicesExistsType<'a, 'b> { - #[doc = "Creates a new instance of [IndicesExistsType] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesExistsTypeParts<'b>) -> Self { - let headers = HeaderMap::new(); - IndicesExistsType { - transport, - parts, - headers, - allow_no_indices: None, - error_trace: None, - expand_wildcards: None, - filter_path: None, - human: None, - ignore_unavailable: None, - local: None, - pretty: None, - request_timeout: None, - source: None, - } - } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } - #[doc = "Include the stack trace of returned errors."] - pub fn error_trace(mut self, error_trace: bool) -> Self { - self.error_trace = Some(error_trace); - self - } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } - #[doc = "A comma-separated list of filters used to reduce the response."] - pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { - self.filter_path = Some(filter_path); - self - } - #[doc = "Adds a HTTP header"] - pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { - self.headers.insert(key, value); - self - } - #[doc = "Return human readable values for statistics."] - pub fn human(mut self, human: bool) -> Self { - self.human = Some(human); - self - } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } - #[doc = "Return local information, do not retrieve the state from master node (default: false)"] - pub fn local(mut self, local: bool) -> Self { - self.local = Some(local); - self - } - #[doc = "Pretty format the returned JSON response."] - pub fn pretty(mut self, pretty: bool) -> Self { - self.pretty = Some(pretty); - self - } - #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] - pub fn request_timeout(mut self, timeout: Duration) -> Self { - self.request_timeout = Some(timeout); - self - } - #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] - pub fn source(mut self, source: &'b str) -> Self { - self.source = Some(source); - self - } - #[doc = "Creates an asynchronous call to the Indices Exists Type API that can be awaited"] - pub async fn send(self) -> Result { - let path = self.parts.url(); - let method = Method::Head; - let headers = self.headers; - let timeout = self.request_timeout; - let query_string = { - #[serde_with::skip_serializing_none] - #[derive(Serialize)] - struct QueryParams<'b> { - allow_no_indices: Option, - error_trace: Option, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - filter_path: Option<&'b [&'b str]>, - human: Option, - ignore_unavailable: Option, - local: Option, - pretty: Option, - source: Option<&'b str>, - } - let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, - error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, - filter_path: self.filter_path, - human: self.human, - ignore_unavailable: self.ignore_unavailable, - local: self.local, - pretty: self.pretty, - source: self.source, - }; - Some(query_params) - }; - let body = Option::<()>::None; - let response = self - .transport - .send(method, &path, headers, query_string.as_ref(), body, timeout) - .await?; - Ok(response) - } -} -#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Indices Flush API"] pub enum IndicesFlushParts<'b> { #[doc = "No parts"] @@ -2912,187 +2751,6 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Flush Synced API"] -pub enum IndicesFlushSyncedParts<'b> { - #[doc = "No parts"] - None, - #[doc = "Index"] - Index(&'b [&'b str]), -} -impl<'b> IndicesFlushSyncedParts<'b> { - #[doc = "Builds a relative URL path to the Indices Flush Synced API"] - pub fn url(self) -> Cow<'static, str> { - match self { - IndicesFlushSyncedParts::None => "/_flush/synced".into(), - IndicesFlushSyncedParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_flush/synced"); - p.into() - } - } - } -} -#[doc = "Builder for the [Indices Flush Synced API](https://opensearch.org/docs/)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] -#[derive(Clone, Debug)] -pub struct IndicesFlushSynced<'a, 'b, B> { - transport: &'a Transport, - parts: IndicesFlushSyncedParts<'b>, - allow_no_indices: Option, - body: Option, - error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, - filter_path: Option<&'b [&'b str]>, - headers: HeaderMap, - human: Option, - ignore_unavailable: Option, - pretty: Option, - request_timeout: Option, - source: Option<&'b str>, -} -impl<'a, 'b, B> IndicesFlushSynced<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [IndicesFlushSynced] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesFlushSyncedParts<'b>) -> Self { - let headers = HeaderMap::new(); - IndicesFlushSynced { - transport, - parts, - headers, - allow_no_indices: None, - body: None, - error_trace: None, - expand_wildcards: None, - filter_path: None, - human: None, - ignore_unavailable: None, - pretty: None, - request_timeout: None, - source: None, - } - } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesFlushSynced<'a, 'b, JsonBody> - where - T: Serialize, - { - IndicesFlushSynced { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - allow_no_indices: self.allow_no_indices, - error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, - filter_path: self.filter_path, - headers: self.headers, - human: self.human, - ignore_unavailable: self.ignore_unavailable, - pretty: self.pretty, - request_timeout: self.request_timeout, - source: self.source, - } - } - #[doc = "Include the stack trace of returned errors."] - pub fn error_trace(mut self, error_trace: bool) -> Self { - self.error_trace = Some(error_trace); - self - } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } - #[doc = "A comma-separated list of filters used to reduce the response."] - pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { - self.filter_path = Some(filter_path); - self - } - #[doc = "Adds a HTTP header"] - pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { - self.headers.insert(key, value); - self - } - #[doc = "Return human readable values for statistics."] - pub fn human(mut self, human: bool) -> Self { - self.human = Some(human); - self - } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } - #[doc = "Pretty format the returned JSON response."] - pub fn pretty(mut self, pretty: bool) -> Self { - self.pretty = Some(pretty); - self - } - #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] - pub fn request_timeout(mut self, timeout: Duration) -> Self { - self.request_timeout = Some(timeout); - self - } - #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] - pub fn source(mut self, source: &'b str) -> Self { - self.source = Some(source); - self - } - #[doc = "Creates an asynchronous call to the Indices Flush Synced API that can be awaited"] - pub async fn send(self) -> Result { - let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; - let headers = self.headers; - let timeout = self.request_timeout; - let query_string = { - #[serde_with::skip_serializing_none] - #[derive(Serialize)] - struct QueryParams<'b> { - allow_no_indices: Option, - error_trace: Option, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - filter_path: Option<&'b [&'b str]>, - human: Option, - ignore_unavailable: Option, - pretty: Option, - source: Option<&'b str>, - } - let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, - error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, - filter_path: self.filter_path, - human: self.human, - ignore_unavailable: self.ignore_unavailable, - pretty: self.pretty, - source: self.source, - }; - Some(query_params) - }; - let body = self.body; - let response = self - .transport - .send(method, &path, headers, query_string.as_ref(), body, timeout) - .await?; - Ok(response) - } -} -#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Indices Forcemerge API"] pub enum IndicesForcemergeParts<'b> { #[doc = "No parts"] @@ -3689,10 +3347,6 @@ pub enum IndicesGetFieldMappingParts<'b> { Fields(&'b [&'b str]), #[doc = "Index and Fields"] IndexFields(&'b [&'b str], &'b [&'b str]), - #[doc = "Type and Fields"] - TypeFields(&'b [&'b str], &'b [&'b str]), - #[doc = "Index, Type and Fields"] - IndexTypeFields(&'b [&'b str], &'b [&'b str], &'b [&'b str]), } impl<'b> IndicesGetFieldMappingParts<'b> { #[doc = "Builds a relative URL path to the Indices Get Field Mapping API"] @@ -3722,40 +3376,6 @@ impl<'b> IndicesGetFieldMappingParts<'b> { p.push_str(encoded_fields.as_ref()); p.into() } - IndicesGetFieldMappingParts::TypeFields(ref ty, ref fields) => { - let ty_str = ty.join(","); - let fields_str = fields.join(","); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_fields: Cow = - percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(17usize + encoded_ty.len() + encoded_fields.len()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/field/"); - p.push_str(encoded_fields.as_ref()); - p.into() - } - IndicesGetFieldMappingParts::IndexTypeFields(ref index, ref ty, ref fields) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let fields_str = fields.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_fields: Cow = - percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 18usize + encoded_index.len() + encoded_ty.len() + encoded_fields.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/field/"); - p.push_str(encoded_fields.as_ref()); - p.into() - } } } } @@ -4071,8 +3691,6 @@ pub enum IndicesGetMappingParts<'b> { Index(&'b [&'b str]), #[doc = "Type"] Type(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> IndicesGetMappingParts<'b> { #[doc = "Builds a relative URL path to the Indices Get Mapping API"] @@ -4089,27 +3707,6 @@ impl<'b> IndicesGetMappingParts<'b> { p.push_str("/_mapping"); p.into() } - IndicesGetMappingParts::Type(ref ty) => { - let ty_str = ty.join(","); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_ty.len()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } - IndicesGetMappingParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } } } } @@ -5623,10 +5220,6 @@ where pub enum IndicesPutMappingParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b str), - #[doc = "Type"] - Type(&'b str), } impl<'b> IndicesPutMappingParts<'b> { #[doc = "Builds a relative URL path to the Indices Put Mapping API"] @@ -5642,26 +5235,6 @@ impl<'b> IndicesPutMappingParts<'b> { p.push_str("/_mapping"); p.into() } - IndicesPutMappingParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mapping"); - p.into() - } - IndicesPutMappingParts::Type(ref ty) => { - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_ty.len()); - p.push_str("/_mappings/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } } } } @@ -8954,8 +8527,6 @@ pub enum IndicesValidateQueryParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> IndicesValidateQueryParts<'b> { #[doc = "Builds a relative URL path to the Indices Validate Query API"] @@ -8972,20 +8543,6 @@ impl<'b> IndicesValidateQueryParts<'b> { p.push_str("/_validate/query"); p.into() } - IndicesValidateQueryParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(18usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_validate/query"); - p.into() - } } } } diff --git a/opensearch/src/lib.rs b/opensearch/src/lib.rs index 7caf0b22..e8ad66f8 100644 --- a/opensearch/src/lib.rs +++ b/opensearch/src/lib.rs @@ -491,7 +491,7 @@ pub mod tests { use crate::SearchParts; #[test] - fn build_search_on_all_indices_and_types() { + fn build_search_on_all_indices() { let parts = SearchParts::None; let url = parts.url(); assert_eq!(url, "/_search"); @@ -511,10 +511,4 @@ pub mod tests { assert_eq!(url, "/%20%21%22%23%24%25%26%27%5C%28%29*%2B,-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D%7E/_search"); } - #[test] - fn build_search_on_selected_indices_and_types() { - let parts = SearchParts::IndexType(&["index-1", "index-2"], &["type-1", "type-2"]); - let url = parts.url(); - assert_eq!(url, "/index-1,index-2/type-1,type-2/_search"); - } } diff --git a/opensearch/src/root/mod.rs b/opensearch/src/root/mod.rs index 45466e82..ee6cfa79 100644 --- a/opensearch/src/root/mod.rs +++ b/opensearch/src/root/mod.rs @@ -47,8 +47,6 @@ pub enum BulkParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> BulkParts<'b> { #[doc = "Builds a relative URL path to the Bulk API"] @@ -64,18 +62,6 @@ impl<'b> BulkParts<'b> { p.push_str("/_bulk"); p.into() } - BulkParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_bulk"); - p.into() - } } } } @@ -592,8 +578,6 @@ pub enum CountParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> CountParts<'b> { #[doc = "Builds a relative URL path to the Count API"] @@ -610,20 +594,6 @@ impl<'b> CountParts<'b> { p.push_str("/_count"); p.into() } - CountParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(9usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_count"); - p.into() - } } } } @@ -898,8 +868,6 @@ where pub enum CreateParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> CreateParts<'b> { #[doc = "Builds a relative URL path to the Create API"] @@ -916,23 +884,6 @@ impl<'b> CreateParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - CreateParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_create"); - p.into() - } } } } @@ -1132,8 +1083,6 @@ where pub enum DeleteParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> DeleteParts<'b> { #[doc = "Builds a relative URL path to the Delete API"] @@ -1150,22 +1099,6 @@ impl<'b> DeleteParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - DeleteParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -1344,8 +1277,6 @@ impl<'a, 'b> Delete<'a, 'b> { pub enum DeleteByQueryParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> DeleteByQueryParts<'b> { #[doc = "Builds a relative URL path to the Delete By Query API"] @@ -1361,20 +1292,6 @@ impl<'b> DeleteByQueryParts<'b> { p.push_str("/_delete_by_query"); p.into() } - DeleteByQueryParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_delete_by_query"); - p.into() - } } } } @@ -2130,8 +2047,6 @@ impl<'a, 'b> DeleteScript<'a, 'b> { pub enum ExistsParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExistsParts<'b> { #[doc = "Builds a relative URL path to the Exists API"] @@ -2148,22 +2063,6 @@ impl<'b> ExistsParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExistsParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -2364,8 +2263,6 @@ impl<'a, 'b> Exists<'a, 'b> { pub enum ExistsSourceParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExistsSourceParts<'b> { #[doc = "Builds a relative URL path to the Exists Source API"] @@ -2382,23 +2279,6 @@ impl<'b> ExistsSourceParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExistsSourceParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_source"); - p.into() - } } } } @@ -2589,8 +2469,6 @@ impl<'a, 'b> ExistsSource<'a, 'b> { pub enum ExplainParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> ExplainParts<'b> { #[doc = "Builds a relative URL path to the Explain API"] @@ -2607,23 +2485,6 @@ impl<'b> ExplainParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - ExplainParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 12usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_explain"); - p.into() - } } } } @@ -3082,8 +2943,6 @@ where pub enum GetParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> GetParts<'b> { #[doc = "Builds a relative URL path to the Get API"] @@ -3100,22 +2959,6 @@ impl<'b> GetParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - GetParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -3677,8 +3520,6 @@ impl<'a, 'b> GetScriptLanguages<'a, 'b> { pub enum GetSourceParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> GetSourceParts<'b> { #[doc = "Builds a relative URL path to the Get Source API"] @@ -3695,23 +3536,6 @@ impl<'b> GetSourceParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - GetSourceParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_source"); - p.into() - } } } } @@ -3904,10 +3728,6 @@ pub enum IndexParts<'b> { IndexId(&'b str, &'b str), #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> IndexParts<'b> { #[doc = "Builds a relative URL path to the Index API"] @@ -3933,33 +3753,6 @@ impl<'b> IndexParts<'b> { p.push_str("/_doc"); p.into() } - IndexParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(2usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } - IndexParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 3usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.into() - } } } } @@ -4313,8 +4106,6 @@ pub enum MgetParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> MgetParts<'b> { #[doc = "Builds a relative URL path to the Mget API"] @@ -4330,18 +4121,6 @@ impl<'b> MgetParts<'b> { p.push_str("/_mget"); p.into() } - MgetParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mget"); - p.into() - } } } } @@ -4560,8 +4339,6 @@ pub enum MsearchParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> MsearchParts<'b> { #[doc = "Builds a relative URL path to the Msearch API"] @@ -4578,20 +4355,6 @@ impl<'b> MsearchParts<'b> { p.push_str("/_msearch"); p.into() } - MsearchParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_msearch"); - p.into() - } } } } @@ -4796,8 +4559,6 @@ pub enum MsearchTemplateParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> MsearchTemplateParts<'b> { #[doc = "Builds a relative URL path to the Msearch Template API"] @@ -4814,20 +4575,6 @@ impl<'b> MsearchTemplateParts<'b> { p.push_str("/_msearch/template"); p.into() } - MsearchTemplateParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(20usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_msearch/template"); - p.into() - } } } } @@ -5012,8 +4759,6 @@ pub enum MtermvectorsParts<'b> { None, #[doc = "Index"] Index(&'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> MtermvectorsParts<'b> { #[doc = "Builds a relative URL path to the Mtermvectors API"] @@ -5029,18 +4774,6 @@ impl<'b> MtermvectorsParts<'b> { p.push_str("/_mtermvectors"); p.into() } - MtermvectorsParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mtermvectors"); - p.into() - } } } } @@ -6824,8 +6557,6 @@ pub enum SearchParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> SearchParts<'b> { #[doc = "Builds a relative URL path to the Search API"] @@ -6842,20 +6573,6 @@ impl<'b> SearchParts<'b> { p.push_str("/_search"); p.into() } - SearchParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_search"); - p.into() - } } } } @@ -7640,8 +7357,6 @@ pub enum SearchTemplateParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> SearchTemplateParts<'b> { #[doc = "Builds a relative URL path to the Search Template API"] @@ -7658,20 +7373,6 @@ impl<'b> SearchTemplateParts<'b> { p.push_str("/_search/template"); p.into() } - SearchTemplateParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_search/template"); - p.into() - } } } } @@ -7938,10 +7639,6 @@ pub enum TermvectorsParts<'b> { IndexId(&'b str, &'b str), #[doc = "Index"] Index(&'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), - #[doc = "Index and Type"] - IndexType(&'b str, &'b str), } impl<'b> TermvectorsParts<'b> { #[doc = "Builds a relative URL path to the Termvectors API"] @@ -7967,35 +7664,6 @@ impl<'b> TermvectorsParts<'b> { p.push_str("/_termvectors"); p.into() } - TermvectorsParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 16usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_termvectors"); - p.into() - } - TermvectorsParts::IndexType(ref index, ref ty) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_termvectors"); - p.into() - } } } } @@ -8239,8 +7907,6 @@ where pub enum UpdateParts<'b> { #[doc = "Index and Id"] IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), } impl<'b> UpdateParts<'b> { #[doc = "Builds a relative URL path to the Update API"] @@ -8257,23 +7923,6 @@ impl<'b> UpdateParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - UpdateParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_update"); - p.into() - } } } } @@ -8526,8 +8175,6 @@ where pub enum UpdateByQueryParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), } impl<'b> UpdateByQueryParts<'b> { #[doc = "Builds a relative URL path to the Update By Query API"] @@ -8543,20 +8190,6 @@ impl<'b> UpdateByQueryParts<'b> { p.push_str("/_update_by_query"); p.into() } - UpdateByQueryParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_update_by_query"); - p.into() - } } } } diff --git a/yaml_test_runner/src/step/do.rs b/yaml_test_runner/src/step/do.rs index ee647723..d8e86adc 100644 --- a/yaml_test_runner/src/step/do.rs +++ b/yaml_test_runner/src/step/do.rs @@ -103,13 +103,10 @@ impl Do { pub fn to_tokens(&self, mut read_response: bool, tokens: &mut Tokens) -> bool { self.api_call.to_tokens(tokens); - // Filter out [types removal] warnings in all cases, same as the java runner. This should - // really be in the yaml tests themselves if !self.warnings.is_empty() { tokens.append(quote! { let warnings: Vec<&str> = response .warning_headers() - .filter(|w| !w.starts_with("[types removal]")) .collect(); }); for warning in &self.warnings { @@ -122,7 +119,6 @@ impl Do { tokens.append(quote! { let allowed_warnings = vec![#(#allowed),*]; let warnings: Vec<&str> = response.warning_headers() - .filter(|w| !w.starts_with("[types removal]") && !allowed_warnings.iter().any(|a| w.contains(a))) .collect(); assert_warnings_is_empty!(warnings); }); From 39801994fe49fc7a391a799658ecd5c579d16413 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Tue, 24 May 2022 16:37:37 -0700 Subject: [PATCH 2/6] Remove include-type-name parameter Signed-off-by: Vacha Shah --- api_generator/rest_specs/indices.create.json | 4 - api_generator/rest_specs/indices.get.json | 4 - .../rest_specs/indices.get_field_mapping.json | 4 - .../rest_specs/indices.get_mapping.json | 4 - .../rest_specs/indices.get_template.json | 4 - .../rest_specs/indices.put_mapping.json | 4 - .../rest_specs/indices.put_template.json | 4 - .../rest_specs/indices.rollover.json | 4 - .../generator/code_gen/url/enum_builder.rs | 2 +- opensearch/src/indices.rs | 92 ------------------- opensearch/src/root/bulk.rs | 2 - 11 files changed, 1 insertion(+), 127 deletions(-) diff --git a/api_generator/rest_specs/indices.create.json b/api_generator/rest_specs/indices.create.json index 6da6f337..4ce62331 100644 --- a/api_generator/rest_specs/indices.create.json +++ b/api_generator/rest_specs/indices.create.json @@ -27,10 +27,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be expected in the body of the mappings." - }, "wait_for_active_shards":{ "type":"string", "description":"Set the number of active shards to wait for before the operation returns." diff --git a/api_generator/rest_specs/indices.get.json b/api_generator/rest_specs/indices.get.json index 5a92236f..c3522981 100644 --- a/api_generator/rest_specs/indices.get.json +++ b/api_generator/rest_specs/indices.get.json @@ -26,10 +26,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether to add the type name to the response (default: false)" - }, "local":{ "type":"boolean", "description":"Return local information, do not retrieve the state from master node (default: false)" diff --git a/api_generator/rest_specs/indices.get_field_mapping.json b/api_generator/rest_specs/indices.get_field_mapping.json index eff35aad..d41883ef 100644 --- a/api_generator/rest_specs/indices.get_field_mapping.json +++ b/api_generator/rest_specs/indices.get_field_mapping.json @@ -42,10 +42,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be returned in the body of the mappings." - }, "include_defaults":{ "type":"boolean", "description":"Whether the default mapping values should be returned as well" diff --git a/api_generator/rest_specs/indices.get_mapping.json b/api_generator/rest_specs/indices.get_mapping.json index 285c22e1..4befbc87 100644 --- a/api_generator/rest_specs/indices.get_mapping.json +++ b/api_generator/rest_specs/indices.get_mapping.json @@ -32,10 +32,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether to add the type name to the response (default: false)" - }, "ignore_unavailable":{ "type":"boolean", "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" diff --git a/api_generator/rest_specs/indices.get_template.json b/api_generator/rest_specs/indices.get_template.json index 1342bbba..646e72f5 100644 --- a/api_generator/rest_specs/indices.get_template.json +++ b/api_generator/rest_specs/indices.get_template.json @@ -32,10 +32,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be returned in the body of the mappings." - }, "flat_settings":{ "type":"boolean", "description":"Return settings in flat format (default: false)" diff --git a/api_generator/rest_specs/indices.put_mapping.json b/api_generator/rest_specs/indices.put_mapping.json index 13868cf3..79a21429 100644 --- a/api_generator/rest_specs/indices.put_mapping.json +++ b/api_generator/rest_specs/indices.put_mapping.json @@ -45,10 +45,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be expected in the body of the mappings." - }, "timeout":{ "type":"time", "description":"Explicit operation timeout" diff --git a/api_generator/rest_specs/indices.put_template.json b/api_generator/rest_specs/indices.put_template.json index 7237bb92..ee486808 100644 --- a/api_generator/rest_specs/indices.put_template.json +++ b/api_generator/rest_specs/indices.put_template.json @@ -28,10 +28,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be returned in the body of the mappings." - }, "order":{ "type":"number", "description":"The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)" diff --git a/api_generator/rest_specs/indices.rollover.json b/api_generator/rest_specs/indices.rollover.json index 891a6625..3d9dfbc1 100644 --- a/api_generator/rest_specs/indices.rollover.json +++ b/api_generator/rest_specs/indices.rollover.json @@ -43,10 +43,6 @@ ] }, "params":{ - "include_type_name":{ - "type":"boolean", - "description":"Whether a type should be included in the body of the mappings." - }, "timeout":{ "type":"time", "description":"Explicit operation timeout" diff --git a/api_generator/src/generator/code_gen/url/enum_builder.rs b/api_generator/src/generator/code_gen/url/enum_builder.rs index 9e0d9085..1076bfbb 100644 --- a/api_generator/src/generator/code_gen/url/enum_builder.rs +++ b/api_generator/src/generator/code_gen/url/enum_builder.rs @@ -397,7 +397,7 @@ mod tests { #[doc = "No parts"] None, #[doc = "Index"] - Index(&'b [&'b str]) + Index(&'b [&'b str]), } ); diff --git a/opensearch/src/indices.rs b/opensearch/src/indices.rs index ea04ddd4..f9f54ad9 100644 --- a/opensearch/src/indices.rs +++ b/opensearch/src/indices.rs @@ -1045,7 +1045,6 @@ pub struct IndicesCreate<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -1068,7 +1067,6 @@ where error_trace: None, filter_path: None, human: None, - include_type_name: None, master_timeout: None, pretty: None, request_timeout: None, @@ -1090,7 +1088,6 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, @@ -1119,11 +1116,6 @@ where self.human = Some(human); self } - #[doc = "Whether a type should be expected in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); @@ -1168,7 +1160,6 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -1179,7 +1170,6 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -2994,7 +2984,6 @@ pub struct IndicesGet<'a, 'b> { human: Option, ignore_unavailable: Option, include_defaults: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3017,7 +3006,6 @@ impl<'a, 'b> IndicesGet<'a, 'b> { human: None, ignore_unavailable: None, include_defaults: None, - include_type_name: None, local: None, master_timeout: None, pretty: None, @@ -3070,11 +3058,6 @@ impl<'a, 'b> IndicesGet<'a, 'b> { self.include_defaults = Some(include_defaults); self } - #[doc = "Whether to add the type name to the response (default: false)"] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -3120,7 +3103,6 @@ impl<'a, 'b> IndicesGet<'a, 'b> { human: Option, ignore_unavailable: Option, include_defaults: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3135,7 +3117,6 @@ impl<'a, 'b> IndicesGet<'a, 'b> { human: self.human, ignore_unavailable: self.ignore_unavailable, include_defaults: self.include_defaults, - include_type_name: self.include_type_name, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -3392,7 +3373,6 @@ pub struct IndicesGetFieldMapping<'a, 'b> { human: Option, ignore_unavailable: Option, include_defaults: Option, - include_type_name: Option, local: Option, pretty: Option, request_timeout: Option, @@ -3413,7 +3393,6 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { human: None, ignore_unavailable: None, include_defaults: None, - include_type_name: None, local: None, pretty: None, request_timeout: None, @@ -3460,11 +3439,6 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { self.include_defaults = Some(include_defaults); self } - #[doc = "Whether a type should be returned in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -3504,7 +3478,6 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { human: Option, ignore_unavailable: Option, include_defaults: Option, - include_type_name: Option, local: Option, pretty: Option, source: Option<&'b str>, @@ -3517,7 +3490,6 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { human: self.human, ignore_unavailable: self.ignore_unavailable, include_defaults: self.include_defaults, - include_type_name: self.include_type_name, local: self.local, pretty: self.pretty, source: self.source, @@ -3689,8 +3661,6 @@ pub enum IndicesGetMappingParts<'b> { None, #[doc = "Index"] Index(&'b [&'b str]), - #[doc = "Type"] - Type(&'b [&'b str]), } impl<'b> IndicesGetMappingParts<'b> { #[doc = "Builds a relative URL path to the Indices Get Mapping API"] @@ -3722,7 +3692,6 @@ pub struct IndicesGetMapping<'a, 'b> { headers: HeaderMap, human: Option, ignore_unavailable: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3743,7 +3712,6 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { filter_path: None, human: None, ignore_unavailable: None, - include_type_name: None, local: None, master_timeout: None, pretty: None, @@ -3786,11 +3754,6 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { self.ignore_unavailable = Some(ignore_unavailable); self } - #[doc = "Whether to add the type name to the response (default: false)"] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -3834,7 +3797,6 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { filter_path: Option<&'b [&'b str]>, human: Option, ignore_unavailable: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3847,7 +3809,6 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { filter_path: self.filter_path, human: self.human, ignore_unavailable: self.ignore_unavailable, - include_type_name: self.include_type_name, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -4114,7 +4075,6 @@ pub struct IndicesGetTemplate<'a, 'b> { flat_settings: Option, headers: HeaderMap, human: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -4133,7 +4093,6 @@ impl<'a, 'b> IndicesGetTemplate<'a, 'b> { filter_path: None, flat_settings: None, human: None, - include_type_name: None, local: None, master_timeout: None, pretty: None, @@ -4166,11 +4125,6 @@ impl<'a, 'b> IndicesGetTemplate<'a, 'b> { self.human = Some(human); self } - #[doc = "Whether a type should be returned in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -4211,7 +4165,6 @@ impl<'a, 'b> IndicesGetTemplate<'a, 'b> { filter_path: Option<&'b [&'b str]>, flat_settings: Option, human: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -4222,7 +4175,6 @@ impl<'a, 'b> IndicesGetTemplate<'a, 'b> { filter_path: self.filter_path, flat_settings: self.flat_settings, human: self.human, - include_type_name: self.include_type_name, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -5251,7 +5203,6 @@ pub struct IndicesPutMapping<'a, 'b, B> { headers: HeaderMap, human: Option, ignore_unavailable: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -5277,7 +5228,6 @@ where filter_path: None, human: None, ignore_unavailable: None, - include_type_name: None, master_timeout: None, pretty: None, request_timeout: None, @@ -5307,7 +5257,6 @@ where headers: self.headers, human: self.human, ignore_unavailable: self.ignore_unavailable, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, @@ -5346,11 +5295,6 @@ where self.ignore_unavailable = Some(ignore_unavailable); self } - #[doc = "Whether a type should be expected in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); @@ -5399,7 +5343,6 @@ where filter_path: Option<&'b [&'b str]>, human: Option, ignore_unavailable: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -5413,7 +5356,6 @@ where filter_path: self.filter_path, human: self.human, ignore_unavailable: self.ignore_unavailable, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -5679,7 +5621,6 @@ pub struct IndicesPutTemplate<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, order: Option, pretty: Option, @@ -5702,7 +5643,6 @@ where error_trace: None, filter_path: None, human: None, - include_type_name: None, master_timeout: None, order: None, pretty: None, @@ -5724,7 +5664,6 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, order: self.order, pretty: self.pretty, @@ -5757,11 +5696,6 @@ where self.human = Some(human); self } - #[doc = "Whether a type should be returned in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); @@ -5802,7 +5736,6 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, order: Option, pretty: Option, @@ -5813,7 +5746,6 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, order: self.order, pretty: self.pretty, @@ -6513,7 +6445,6 @@ pub struct IndicesRollover<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -6537,7 +6468,6 @@ where error_trace: None, filter_path: None, human: None, - include_type_name: None, master_timeout: None, pretty: None, request_timeout: None, @@ -6560,7 +6490,6 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, @@ -6594,11 +6523,6 @@ where self.human = Some(human); self } - #[doc = "Whether a type should be included in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); @@ -6644,7 +6568,6 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -6656,7 +6579,6 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -8887,24 +8809,10 @@ impl<'a> Indices<'a> { ) -> IndicesExistsTemplate<'a, 'b> { IndicesExistsTemplate::new(self.transport(), parts) } - #[doc = "[Indices Exists Type API](https://opensearch.org/docs/)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] - pub fn exists_type<'b>( - &'a self, - parts: IndicesExistsTypeParts<'b>, - ) -> IndicesExistsType<'a, 'b> { - IndicesExistsType::new(self.transport(), parts) - } #[doc = "[Indices Flush API](https://opensearch.org/docs/)\n\nPerforms the flush operation on one or more indices."] pub fn flush<'b>(&'a self, parts: IndicesFlushParts<'b>) -> IndicesFlush<'a, 'b, ()> { IndicesFlush::new(self.transport(), parts) } - #[doc = "[Indices Flush Synced API](https://opensearch.org/docs/)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] - pub fn flush_synced<'b>( - &'a self, - parts: IndicesFlushSyncedParts<'b>, - ) -> IndicesFlushSynced<'a, 'b, ()> { - IndicesFlushSynced::new(self.transport(), parts) - } #[doc = "[Indices Forcemerge API](https://opensearch.org/docs/)\n\nPerforms the force merge operation on one or more indices."] pub fn forcemerge<'b>( &'a self, diff --git a/opensearch/src/root/bulk.rs b/opensearch/src/root/bulk.rs index efa83eed..b2374e26 100644 --- a/opensearch/src/root/bulk.rs +++ b/opensearch/src/root/bulk.rs @@ -63,8 +63,6 @@ enum BulkAction { #[derive(Serialize, Default)] struct BulkMetadata { _index: Option, - // TODO: intentionally omit type for now, as it's going away. - //_type: Option, _id: Option, pipeline: Option, if_seq_no: Option, From d2fcaa18d43f63b64f88c8eaf401141c4061b332 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Fri, 27 May 2022 01:16:32 +0000 Subject: [PATCH 3/6] Fixing tests to use correct yaml files for test inputs Signed-off-by: Vacha Shah --- api_generator/rest_specs/last_downloaded_version | 2 +- yaml_test_runner/src/main.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api_generator/rest_specs/last_downloaded_version b/api_generator/rest_specs/last_downloaded_version index e28dc5ba..525a4bd0 100644 --- a/api_generator/rest_specs/last_downloaded_version +++ b/api_generator/rest_specs/last_downloaded_version @@ -1 +1 @@ -7.x \ No newline at end of file +1.x \ No newline at end of file diff --git a/yaml_test_runner/src/main.rs b/yaml_test_runner/src/main.rs index dcb824cc..1dcadfbb 100644 --- a/yaml_test_runner/src/main.rs +++ b/yaml_test_runner/src/main.rs @@ -159,16 +159,22 @@ fn branch_suite_and_version_from_opensearch( let mut response = client.get(url).basic_auth("admin", Some("admin")).send()?; let json: Value = response.json()?; - let branch = json["version"]["build_hash"].as_str().unwrap().to_string(); + let mut branch = json["version"]["build_hash"].as_str().unwrap().to_string(); // any prerelease part needs to be trimmed because the semver crate only allows // a version with a prerelease to match against predicates, if at least one predicate // has a prerelease. See // https://github.com/steveklabnik/semver/blob/afa5fc853cb4d6d2b1329579e5528f86f3b550f9/src/version_req.rs#L319-L331 - let version = json["version"]["number"] + let mut version = json["version"]["number"] .as_str() .unwrap() .trim_end_matches(|c: char| c.is_alphabetic() || c == '-'); + if version.to_string().starts_with("1.") { + info!("Found a 1.x version"); + // If a 1.x version is found for OpenSearch, use the yaml files from 2.0 branch since type is removed from 2.0. + version = "2.0.0"; + branch = "5d6eeed3830ebd66ba5bfacc3ba94d901dede89a".to_string(); + } Ok((branch, suite, semver::Version::parse(version)?)) } From 3209036e355e601ab1b08bb557d61e6709b35979 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Fri, 27 May 2022 01:20:22 +0000 Subject: [PATCH 4/6] Add OpenSearch 2.0 to the test matrix Signed-off-by: Vacha Shah --- .github/workflows/test-integrations.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-integrations.yml b/.github/workflows/test-integrations.yml index 7f45b59d..068d7e0f 100644 --- a/.github/workflows/test-integrations.yml +++ b/.github/workflows/test-integrations.yml @@ -22,6 +22,8 @@ jobs: - { cluster: 'opensearch', version: '1.2.4', secured: 'false' } - { cluster: 'opensearch', version: '1.1.0', secured: 'true' } - { cluster: 'opensearch', version: '1.1.0', secured: 'false' } + - { cluster: 'opensearch', version: '2.0.0', secured: 'true' } + - { cluster: 'opensearch', version: '2.0.0', secured: 'false' } steps: - name: Checkout From e7dd664f13f304c147ac184abba9de408237fe0f Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Fri, 27 May 2022 01:46:30 +0000 Subject: [PATCH 5/6] Handling opendistro tests for yaml docs Signed-off-by: Vacha Shah --- yaml_test_runner/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yaml_test_runner/src/main.rs b/yaml_test_runner/src/main.rs index 1dcadfbb..ea032169 100644 --- a/yaml_test_runner/src/main.rs +++ b/yaml_test_runner/src/main.rs @@ -170,9 +170,9 @@ fn branch_suite_and_version_from_opensearch( .unwrap() .trim_end_matches(|c: char| c.is_alphabetic() || c == '-'); - if version.to_string().starts_with("1.") { - info!("Found a 1.x version"); - // If a 1.x version is found for OpenSearch, use the yaml files from 2.0 branch since type is removed from 2.0. + if version.to_string().starts_with("1.") || version.to_string().starts_with("7.") { + info!("Found a 1.x/7.x version, using yaml docs from 2.0 version since type mapping related tests has been removed"); + // If a 1.x/7.x version is found for OpenSearch, use the yaml files from 2.0 branch since type is removed from 2.0. version = "2.0.0"; branch = "5d6eeed3830ebd66ba5bfacc3ba94d901dede89a".to_string(); } From 450b03e486a9448bbd9d0d23bf994347008c375d Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Fri, 27 May 2022 02:24:52 +0000 Subject: [PATCH 6/6] Addressing comments Signed-off-by: Vacha Shah --- yaml_test_runner/src/main.rs | 2 +- yaml_test_runner/src/step/do.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/yaml_test_runner/src/main.rs b/yaml_test_runner/src/main.rs index ea032169..bb288561 100644 --- a/yaml_test_runner/src/main.rs +++ b/yaml_test_runner/src/main.rs @@ -170,7 +170,7 @@ fn branch_suite_and_version_from_opensearch( .unwrap() .trim_end_matches(|c: char| c.is_alphabetic() || c == '-'); - if version.to_string().starts_with("1.") || version.to_string().starts_with("7.") { + if version.starts_with("1.") || version.starts_with("7.") { info!("Found a 1.x/7.x version, using yaml docs from 2.0 version since type mapping related tests has been removed"); // If a 1.x/7.x version is found for OpenSearch, use the yaml files from 2.0 branch since type is removed from 2.0. version = "2.0.0"; diff --git a/yaml_test_runner/src/step/do.rs b/yaml_test_runner/src/step/do.rs index d8e86adc..ebd5a7d0 100644 --- a/yaml_test_runner/src/step/do.rs +++ b/yaml_test_runner/src/step/do.rs @@ -119,6 +119,7 @@ impl Do { tokens.append(quote! { let allowed_warnings = vec![#(#allowed),*]; let warnings: Vec<&str> = response.warning_headers() + .filter(!allowed_warnings.iter().any(|a| w.contains(a))) .collect(); assert_warnings_is_empty!(warnings); });