Skip to content

Commit cfac6d1

Browse files
add info on metadata header (#3377)
1 parent 00686cf commit cfac6d1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

reference/api/overview.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,40 @@ Meilisearch compresses a response if the request contains the `Accept-Encoding`
117117
curl -sH 'Accept-encoding: gzip' 'MEILISEARCH_URL/indexes/movies/search' | gzip -
118118
```
119119

120+
### Search metadata
121+
122+
You may use an optional `Meili-Include-Metadata` header when performing search and multi-search requests:
123+
124+
```
125+
curl -X POST 'http://localhost:7700/indexes/INDEX_NAME/search' \
126+
-H 'Content-Type: application/json' \
127+
-H 'Authorization: Bearer MEILISEARCH_API_KEY' \
128+
-H 'Meili-Include-Metadata: true' \
129+
-d '{"q": ""}'
130+
```
131+
132+
Responses will include a `metadata` object:
133+
134+
```json
135+
{
136+
"hits": [ ],
137+
"metadata": {
138+
"queryUid": "0199a41a-8186-70b3-b6e1-90e8cb582f35",
139+
"indexUid": "INDEX_NAME",
140+
"primaryKey": "INDEX_PRIMARY_KEY"
141+
}
142+
}
143+
```
144+
145+
`metadata` contains the following fields:
146+
147+
| Field | Type | Description |
148+
|:------------:|:-------:|:----------------------------------------------------------:|
149+
| `queryUid` | UUID v7 | Unique identifier for the query |
150+
| `indexUid` | String | Index identifier |
151+
| `primaryKey` | String | Primary key field name, if index has a primary key |
152+
| `remote` | String | Remote instance name, if request targets a remote instance |
153+
120154
## Request body
121155

122156
The request body is data sent to the API. It is used with PUT, POST, and PATCH methods to create or update a resource. You must provide request bodies in JSON.

0 commit comments

Comments
 (0)