diff --git a/rest-api-spec/api/explain.json b/rest-api-spec/api/explain.json index 1d7a9c309f4..81abcc10eb6 100644 --- a/rest-api-spec/api/explain.json +++ b/rest-api-spec/api/explain.json @@ -72,8 +72,20 @@ "source": { "type" : "string", "description" : "The URL-encoded query definition (instead of using the request body)" + }, + "_source": { + "type" : "list", + "description" : "True or false to return the _source field or not, or a list of fields to return" + }, + "_source_exclude": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_include": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" } - } + }, }, "body": { "description" : "The query definition using the Query DSL" diff --git a/rest-api-spec/api/get.json b/rest-api-spec/api/get.json index b1fd3ef9fa1..96498882288 100644 --- a/rest-api-spec/api/get.json +++ b/rest-api-spec/api/get.json @@ -47,6 +47,18 @@ "routing": { "type" : "string", "description" : "Specific routing value" + }, + "_source": { + "type" : "list", + "description" : "True or false to return the _source field or not, or a list of fields to return" + }, + "_source_exclude": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_include": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" } } }, diff --git a/rest-api-spec/api/get_source.json b/rest-api-spec/api/get_source.json index 2fa4baa1b7c..5203f2b4cd4 100644 --- a/rest-api-spec/api/get_source.json +++ b/rest-api-spec/api/get_source.json @@ -24,6 +24,14 @@ } }, "params": { + "_source_exclude": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_include": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" + }, "parent": { "type" : "string", "description" : "The ID of the parent document" diff --git a/rest-api-spec/api/mget.json b/rest-api-spec/api/mget.json index f4872e45737..a875136db9f 100644 --- a/rest-api-spec/api/mget.json +++ b/rest-api-spec/api/mget.json @@ -31,6 +31,18 @@ "refresh": { "type" : "boolean", "description" : "Refresh the shard containing the document before performing the operation" + }, + "_source": { + "type" : "list", + "description" : "True or false to return the _source field or not, or a list of fields to return" + }, + "_source_exclude": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_include": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" } } }, diff --git a/rest-api-spec/api/search.json b/rest-api-spec/api/search.json index af778d5ef58..90fab84dec1 100644 --- a/rest-api-spec/api/search.json +++ b/rest-api-spec/api/search.json @@ -98,6 +98,18 @@ "type" : "string", "description" : "The URL-encoded request definition using the Query DSL (instead of using request body)" }, + "_source": { + "type" : "list", + "description" : "True or false to return the _source field or not, or a list of fields to return" + }, + "_source_exclude": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_include": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" + }, "stats": { "type" : "list", "description" : "Specific 'tag' of the request for logging and statistical purposes" diff --git a/rest-api-spec/test/explain/10_source_filtering.yaml b/rest-api-spec/test/explain/20_source_filtering.yaml similarity index 100% rename from rest-api-spec/test/explain/10_source_filtering.yaml rename to rest-api-spec/test/explain/20_source_filtering.yaml diff --git a/rest-api-spec/test/get_source/70_source_filtering.yaml b/rest-api-spec/test/get_source/70_source_filtering.yaml index 71c36fe3f4c..5d6c0ad0512 100644 --- a/rest-api-spec/test/get_source/70_source_filtering.yaml +++ b/rest-api-spec/test/get_source/70_source_filtering.yaml @@ -12,18 +12,18 @@ body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 } - do: - get_source: { index: test_1, type: test, id: 1, include: include.field1 } + get_source: { index: test_1, type: test, id: 1, _source_include: include.field1 } - match: { include.field1: v1 } - is_false: include.field2 - do: - get_source: { index: test_1, type: test, id: 1, include: "include.field1,include.field2" } + get_source: { index: test_1, type: test, id: 1, _source_include: "include.field1,include.field2" } - match: { include.field1: v1 } - match: { include.field2: v2 } - is_false: count - do: - get_source: { index: test_1, type: test, id: 1, include: include, exclude: "*.field2" } + get_source: { index: test_1, type: test, id: 1, _source_include: include, _source_exclude: "*.field2" } - match: { include.field1: v1 } - is_false: include.field2 - is_false: count