You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
Documents API - displayedAttributes should not impact the documents API / Rename attributesToRetrieve to fields (#143)
* Specifies that displayedAttributes setting does not impact the GET documents endpoint
* Rename attributeToRetrieve to fields on /documents
* Add a future possibily to rejectt a field from a document in the given response
* Precise behavior details about fields query parameter
* Add fields query parameter on GET /indexes/{index}/documents/{docId}
Copy file name to clipboardExpand all lines: open-api.yaml
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -156,7 +156,7 @@ components:
156
156
type:
157
157
- string
158
158
- number
159
-
description: Retrieve attributes of the document. `attributesToRetrieve` controls these fields.
159
+
description: Retrieve attributes of a search result. `attributesToRetrieve` controls these fields.
160
160
_geoDistance:
161
161
type: number
162
162
description: 'Using _geoPoint({lat}, {lng}) built-in sort rule at search leads the engine to return a _geoDistance within the search results. This field represents the distance in meters of the document from the specified _geoPoint.'
@@ -815,6 +815,16 @@ components:
815
815
816
816
> warn
817
817
> Attribute(s) used in `filter` should be declared as filterable attributes. See [Filtering and Faceted Search](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html).
818
+
fields:
819
+
name: fields
820
+
in: query
821
+
description: 'Comma-separated list of fields to display for an API resource. By default it contains all fields of an API resource.'
@@ -72,19 +74,24 @@ Sets the starting point in the results, effectively skipping over a given number
72
74
73
75
Sets the maximum number of documents to be returned by the current request.
74
76
75
-
###### 3.1.1.2.3. `attributesToRetrieve`
77
+
###### 3.1.1.2.3. `fields`
76
78
77
79
- Type: String
78
80
- Required: False
79
-
- Default: `null`
81
+
- Default: `*`
80
82
81
83
Configures which attributes will be retrieved in the returned documents.
82
84
83
-
If no value is specified, `attributesToRetrieve` uses the `displayedAttributes` list, which by default contains all attributes found in the documents.
85
+
If `fields` is not specified, all attributes from the documents are returned in the response. It's equivalent to `fields=*`.
86
+
87
+
- Sending `fields` without specifying a value, returns empty documents ressources. `fields=`.
88
+
- Sending `fields` with a non-existent field as part of the value will not return an error, the non-existent field will not be displayed.
84
89
85
-
> If an attribute has been removed from `displayedAttributes` index settings, `attributesToRetrieve` will silently ignore it and the field will not appear in the returned documents.
90
+
> `fields` values are case-sensitive.
86
91
87
-
> Specified fields have to be separated by a comma. e.g. `&attributesToRetrieve=title,description`
92
+
> Specified fields have to be separated by a comma. e.g. `&fields=title,description`
93
+
94
+
> The index setting `displayedAttributes` has no impact on this endpoint.
88
95
89
96
##### 3.1.1.3. Response Definition
90
97
@@ -153,7 +160,7 @@ Gives the total number of documents that can be browsed in the related index.
153
160
154
161
- 🔴 Sending a value with a different type than `Integer` or `null` for `offset` will return a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
155
162
- 🔴 Sending a value with a different type than `Integer` or `null` for `limit` will return a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
156
-
- 🔴 Sending a value with a different type than `String` or `null` for `attributesToRetrieve` will return a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
163
+
- 🔴 Sending a value with a different type than `String` or `null` for `fields` will return a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
Configures which attributes will be retrieved in the returned documents.
203
+
204
+
If `fields` is not specified, all attributes from the documents are returned in the response. It's equivalent to `fields=*`.
205
+
206
+
- Sending `fields` without specifying a value, returns empty documents ressources. `fields=`.
207
+
- Sending `fields` with a non-existent field as part of the value will not return an error, the non-existent field will not be displayed.
208
+
209
+
> `fields` values are case-sensitive.
210
+
211
+
> Specified fields have to be separated by a comma. e.g. `&fields=title,description`
212
+
213
+
> The index setting `displayedAttributes` has no impact on this endpoint.
214
+
215
+
##### 3.1.2.3. Request Payload Definition
184
216
N/A
185
217
186
-
##### 3.1.2.2. Response Definition
218
+
##### 3.1.2.4. Response Definition
187
219
188
220
A document represented as a JSON object.
189
221
190
-
##### 3.1.2.2.1. Example
222
+
##### 3.1.2.4.1. Example
191
223
192
224
```json
193
225
{
@@ -199,10 +231,11 @@ A document represented as a JSON object.
199
231
}
200
232
```
201
233
202
-
##### 3.1.2.3. Errors
234
+
##### 3.1.2.5. Errors
203
235
204
236
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
205
237
- 🔴 If the requested `document_id` does not exist, the API returns an [document_not_found](0061-error-format-and-definitions.md#document_not_found) error.
238
+
- 🔴 Sending a value with a different type than `String` or `null` for `fields` will return a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
0 commit comments