Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion en/reference/api/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ <h3>Error code to status code mapping</h3>
<h2 id="select.json">select</h2>
<p>
A <code>select</code> query is equivalent in structure to YQL, written in JSON.
Contains subparameters <code>where</code> and <code>grouping</code>.
Contains subparameters <code>where</code>, <code>grouping</code> and <code>fields</code>.
</p>
<table class="table">
<thead>
Expand Down Expand Up @@ -2368,5 +2368,18 @@ <h2 id="select.json">select</h2>
</p>
</td>
</tr>
<tr>
<th>fields</th>
<td></td>
<td>String</td>
<td></td>
<td>
<p id="select.fields">
A JSON array of <a href="../../querying/document-summaries.html#selecting-summary-fields-in-yql">summary field</a>
names to include in each hit. Equivalent to the field list in a YQL <code>select</code> clause.
Refer to the <a href="../querying/json-query-language">select reference</a> for details.
</p>
</td>
</tr>
</tbody>
</table>
31 changes: 30 additions & 1 deletion en/reference/querying/json-query-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [...]
}
```

Expand Down Expand Up @@ -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.
Expand Down