Skip to content

Conversation

junhaoliao
Copy link
Member

@junhaoliao junhaoliao commented Sep 24, 2025

Description

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

task docs:serve and viewed http://127.0.0.1:8080/dev-docs/design-search-query-flow.html to confirm the document was rendered as expected.

@junhaoliao junhaoliao requested a review from All-less September 24, 2025 15:15
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.


Upon receiving the query, the server:

1. **Creates two jobs in MySQL database**:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: mention name of the query job table

Comment on lines +109 to +110
- Collection named after `searchJobId`
- Collection named after `aggregationJobId`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Collection named after `searchJobId`
- Collection named after `aggregationJobId`
- Collection named after `searchJobId`, for receiving log event results
- Collection named after `aggregationJobId`, for receiving time-based aggregation results


### 4. Result caching in MongoDB

Search results are stored in MongoDB with the following characteristics:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Personally, I would like more description here about how the results are handled. Below is my attempt, and feel free to correct/refine it.)

MongoDB gathers the results from the distributed search and caches them for future use (e.g., subsequent user queries). After the workers finish their search tasks, they write the results into a MongoDB collection.


Search results are stored in MongoDB with the following characteristics:

1. **Collection structure**: Each job has its own collection named after its job ID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Collection name: Each job has its own collection named after its job ID (see bullet 2 of 2. Server-side processing)

The storage and query engine settings are configured in the package's `etc/clp-config.yml` and
they are passed to the WebUI client via `client/public/settings.json` and the server via
`server/settings.json` at startup.

Copy link
Contributor

@All-less All-less Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe list the major databases and table/collection structures here. They are mentioned several times throughout the document, so it's helpful to give readers a quick preview.

## Major Data Structures

1. A `query_jobs` table in MariaDB/MySQL tracks the search job status. 
- `id`: The ID of the query job.
- `status`: The status of the query job.
- `job_config`: The configuration of the query job.

2. The `clp-query-results` database in MongoDB caches the search results. 
...

3. The `results-metadata` database in MongoDB tracks ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants