diff --git a/en/reference/api/query.html b/en/reference/api/query.html index 66579b38be..25d989af39 100644 --- a/en/reference/api/query.html +++ b/en/reference/api/query.html @@ -2331,7 +2331,7 @@

Error code to status code mapping

select

A select query is equivalent in structure to YQL, written in JSON. - Contains subparameters where and grouping. + Contains subparameters where, grouping and fields.

@@ -2368,5 +2368,18 @@

select

+ + + + + + +
fieldsString +

+ A JSON array of summary field + names to include in each hit. Equivalent to the field list in a YQL select clause. + Refer to the select reference for details. +

+
diff --git a/en/reference/querying/json-query-language.md b/en/reference/querying/json-query-language.md index 65fdfc0f81..c7b123f06f 100644 --- a/en/reference/querying/json-query-language.md +++ b/en/reference/querying/json-query-language.md @@ -16,7 +16,8 @@ The query has JSON syntax, and can be used with queries that are executed with H ```json "select" : { "where" : {...}, - "grouping" : {...} + "grouping" : {...}, + "fields" : [...] } ``` @@ -91,6 +92,34 @@ which is equivalent with the YQL. +### Fields + +Available since {% include version.html version="8.680.18" %}. + +The `fields` parameter restricts which +[summary fields](../../querying/document-summaries.html#selecting-summary-fields-in-yql) +are included in each hit. It is a JSON array of field names, and is equivalent +to the field list in a YQL `select` clause. + +YQL: `select id, title from sources * where title contains 'madonna'`. + +Equivalent JSON: + +```json +{ + "select": { + "fields": ["id", "title"], + "where": { + "contains": ["title", "madonna"] + } + } +} +``` + +If `fields` is omitted or empty, all fields of the chosen +[document summary class](../../querying/document-summaries.html) are returned. + + ### Grouping One or more [grouping statements](../../querying/grouping.html) can be set as a JSON array in the `grouping` field.