From a78781cdc654c91e0cad349ba098a154bfd1b0be Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Mon, 23 Sep 2013 13:23:25 +0200 Subject: [PATCH] [API] Added _source,_source_include,_source_exclude to * explain * get * mget * search * get_source --- rest-api-spec/api/explain.json | 14 +++++++++++++- rest-api-spec/api/get.json | 12 ++++++++++++ rest-api-spec/api/get_source.json | 8 ++++++++ rest-api-spec/api/mget.json | 12 ++++++++++++ rest-api-spec/api/search.json | 12 ++++++++++++ ...rce_filtering.yaml => 20_source_filtering.yaml} | 0 .../test/get_source/70_source_filtering.yaml | 6 +++--- 7 files changed, 60 insertions(+), 4 deletions(-) rename rest-api-spec/test/explain/{10_source_filtering.yaml => 20_source_filtering.yaml} (100%) 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