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
Copy file name to clipboardExpand all lines: docs/reference/rest-api.md
+8-13Lines changed: 8 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,6 @@ position: 9
7
7
8
8
All the API endpoints start with the `api/v1/` prefix. `v1` indicates that we are currently using version 1 of the API.
9
9
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
-
18
10
### Parameters
19
11
20
12
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
40
32
### Search in an index
41
33
42
34
```
43
-
GET api/v1/indexes/<index id>/search
35
+
GET api/v1/indexes/<index id>/search?query=searchterm
44
36
```
45
37
46
38
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>`.
61
53
|**endTimestamp**|`i64`| If set, restrict search to documents with a `timestamp < end_timestamp`||
62
54
|**startOffset**|`Integer`| Number of documents to skip |`0`|
63
55
|**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 |
65
57
|**format**|`Enum`| The output format. Allowed values are "json" or "prettyjson" |`prettyjson`|
66
58
67
59
68
60
#### Response
69
61
62
+
The response for the is a JSON object, and the content type is `application/json; charset=UTF-8.`
@@ -76,7 +70,7 @@ Search for documents matching a query in the given index `<index id>`.
76
70
### Search stream in an index
77
71
78
72
```
79
-
GET api/v1/indexes/<index id>/search/stream
73
+
GET api/v1/indexes/<index id>/search/stream?query=searchterm
80
74
```
81
75
82
76
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
103
97
|----------|------|-------------|---------------|
104
98
|**query**|`String`| Query text. See the [query language doc](query-language.md) (mandatory) ||
105
99
|**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 |
107
101
|**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`||
109
103
|**outputFormat**|`String`| Response output format. `csv` or `clickHouseRowBinary`|`csv`|
110
104
111
105
112
106
#### Response
107
+
113
108
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.
114
109
115
110
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