Skip to content

Commit

Permalink
Set search after values in millis by default. (#4299)
Browse files Browse the repository at this point in the history
* Set search after values in millis by default.

* Update ES API docs.

* Remove option from vec of sort datetime field booleans

* Use hashmap.

* Fix clippy
  • Loading branch information
fmassot authored Jan 2, 2024
1 parent e978050 commit 6bf394d
Show file tree
Hide file tree
Showing 7 changed files with 436 additions and 152 deletions.
24 changes: 18 additions & 6 deletions docs/reference/es_compatible_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ following syntax.
{
// ...
"sort" : [
{ "timestamp" : {"format": "epoch_millis_as_int","order" : "asc"}},
{ "timestamp" : {"order" : "asc"}},
{ "serial_number" : "desc" }
]
// ...
Expand All @@ -186,9 +186,21 @@ It is also possible to not supply an order and rely on the default order using t
}
```

If no format is provided for timestamps, timestamps are returned with nanosecond precision. Beware
this means the resulting json may contain high numbers for which there is loss of precision when
using languages where all numbers are floats, such as JavaScript.
If no format is provided for timestamps, timestamps are returned with milliseconds precision.

If you need nanosecond precision, you can use the `epoch_nanos_int` format. Beware this means the resulting
JSON may contain high numbers for which there is loss of precision when using languages where all numbers are
floats, such as JavaScript.

```json
{
// ...
"sort" : [
{ "timestamp" : {"format": "epoch_nanos_int","order" : "asc"}},
{ "serial_number" : "desc" }
]
// ...
}

#### Search after

Expand All @@ -204,7 +216,7 @@ When sorting results, the answer looks like the following
{
// ...
"sort": [
1701962929199000000
1701962929199
]
}
]
Expand All @@ -217,7 +229,7 @@ You can pass the `sort` value of the last hit in a subsequent request where othe
{
// keep all fields from the original request
"seach_after": [
1701962929199000000
1701962929199
]
}
```
Expand Down
1 change: 1 addition & 0 deletions quickwit/quickwit-proto/protos/quickwit/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ enum SortOrder {
// for future extension.
enum SortDatetimeFormat {
UNIX_TIMESTAMP_MILLIS = 0;
UNIX_TIMESTAMP_NANOS = 1;
}

message SearchResponse {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6bf394d

Please sign in to comment.