Skip to content

Commit 8f515ee

Browse files
authored
Fix Rest API docs (#1080)
improve GET docs Remove Format block with reference to POST/PUT, there are no POST/PUT rename searchFields parameter to searchField
1 parent bd2db8c commit 8f515ee

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

docs/reference/rest-api.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ position: 9
77

88
All the API endpoints start with the `api/v1/` prefix. `v1` indicates that we are currently using version 1 of the API.
99

10-
11-
## Format
12-
13-
The API uses **JSON** encoded as **UTF-8**. The body of POST and PUT requests must be a JSON object and their `Content-Type` header should be set to `application/json; charset=UTF-8`.
14-
15-
The response for the /search endpoint is always a JSON object, and the content type is always `application/json; charset=UTF-8.`
16-
The response for the /search/stream endpoint is a HTTP stream. Depending on the client capability it is a HTTP1.1 [chunked transfer encoded stream](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) or a HTTP2 stream.
17-
1810
### Parameters
1911

2012
Parameters passed in the URL must be properly URL-encoded, using the UTF-8 encoding for non-ASCII characters.
@@ -40,7 +32,7 @@ Failed requests return a 4xx HTTP status code. The response body of failed reque
4032
### Search in an index
4133

4234
```
43-
GET api/v1/indexes/<index id>/search
35+
GET api/v1/indexes/<index id>/search?query=searchterm
4436
```
4537

4638
Search for documents matching a query in the given index `<index id>`.
@@ -61,12 +53,14 @@ Search for documents matching a query in the given index `<index id>`.
6153
| **endTimestamp** | `i64` | If set, restrict search to documents with a `timestamp < end_timestamp` | |
6254
| **startOffset** | `Integer` | Number of documents to skip | `0` |
6355
| **maxHits** | `Integer` | Maximum number of hits to return (by default 20) | `20` |
64-
| **searchFields** | `String` | Fields to search on if no field name is specified in the query. Comma-separated list, e.g. "field1,field2" | index_config.search_settings.default_search_fields |
56+
| **searchField** | `[String]` | Fields to search on if no field name is specified in the query. Comma-separated list, e.g. "field1,field2" | index_config.search_settings.default_search_fields |
6557
| **format** | `Enum` | The output format. Allowed values are "json" or "prettyjson" | `prettyjson` |
6658

6759

6860
#### Response
6961

62+
The response for the is a JSON object, and the content type is `application/json; charset=UTF-8.`
63+
7064
| Field | Description | Type |
7165
| -------------------- | ------------------------------ | :--------: |
7266
| **hits** | Results of the query | `[hit]` |
@@ -76,7 +70,7 @@ Search for documents matching a query in the given index `<index id>`.
7670
### Search stream in an index
7771

7872
```
79-
GET api/v1/indexes/<index id>/search/stream
73+
GET api/v1/indexes/<index id>/search/stream?query=searchterm
8074
```
8175

8276
Streams field values from ALL documents matching a search query in the given index `<index id>`, in a specified output format among the following:
@@ -103,13 +97,14 @@ The endpoint will return 10 million values if 10 million documents match the que
10397
|----------|------|-------------|---------------|
10498
| **query** | `String` | Query text. See the [query language doc](query-language.md) (mandatory) | |
10599
| **fastField** | `String` | Name of a field to retrieve from documents. This field must be marked as "fast" in the index config. (mandatory)| |
106-
| **searchFields** | `[String]` | Fields to search on. Comma-separated list, e.g. "field1,field2" | index_config.search_settings.default_search_fields |
100+
| **searchField** | `[String]` | Fields to search on. Comma-separated list, e.g. "field1,field2" | index_config.search_settings.default_search_fields |
107101
| **startTimestamp** | `i64` | If set, restrict search to documents with a `timestamp >= start_timestamp` | |
108-
| **endTimestamp** | `i64` | If set, restrict search to documents with a `timestamp < end_timestamp`` | |
102+
| **endTimestamp** | `i64` | If set, restrict search to documents with a `timestamp < end_timestamp` | |
109103
| **outputFormat** | `String` | Response output format. `csv` or `clickHouseRowBinary` | `csv` |
110104

111105

112106
#### Response
107+
113108
The response is an HTTP stream. Depending on the client's capability, it is an HTTP1.1 [chunked transfer encoded stream](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) or an HTTP2 stream.
114109

115110
It returns a list of all the field values from documents matching the query. The field must be marked as "fast" in the index config for this to work.

0 commit comments

Comments
 (0)