openobserve / openobserve

πŸš€ 10x easier, πŸš€ 140x lower storage cost, πŸš€ high performance, πŸš€ petabyte scale - Elasticsearch/Splunk/Datadog alternative for πŸš€ (logs, metrics, traces, RUM, Error tracking, Session replay).

Home Page:https://openobserve.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Querying the latest log records without specifying `query.end_time` returns no results

juliennonin opened this issue Β· comments

Which OpenObserve functionalities are the source of the bug?

log search

Is this a regression?

Yes

Description

This issue concerns the log search endpoint POST api/craft-ai/_search?type=logs.

When specifying both query.start_time and query.end_time, records are properly retrieved.

Request body:

{
   "query": {
       "sql": "SELECT * FROM stream ORDER BY _timestamp;",
       "size": 100,
       "start_time": 1714632462144000,
       "end_time": 1714642649216446
   }
}

However, when query.end_time field is omitted, the query returns no log record.

Request body:

{
   "query": {
       "sql": "SELECT * FROM stream ORDER BY _timestamp;",
       "size": 100,
       "start_time": 1714632462144000,
   }
}

Response body:

{
   "took": 3,
   "took_detail": { "total": 3, "wait_queue": 0, "cluster_total": 3, "cluster_wait_queue": 0 },
   "hits": [],
   "total": 0,
   "from": 0,
   "size": 100,
   "cached_ratio": 0,
   "scan_size": 0,
   "scan_records": 0,
   "trace_id": "2fwl8njQ96CR20yoYi7UkWu6aZp"
}

The expected behavior is that which is documented, i.e.

query.end_time, unit: microseconds, filter data by time range, without it, will scan data from start_time to NOW

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the version you discovered this bug in (check about page for version information)

Version: v0.10.5
Commit Hash: 30d06f180da82120f75eb08b702eeb0e10438470
Build Date: 2024-04-30T09:31:56Z

Anything else?

No response

Yes, i will update the document, the start_time and end_time is not optional now. Because of in the case it will try to search on all the data, but some user has a lot of data, it will cause unexpected problem.