Skip to content

Update GET collections/{}/optimizations#7946

Merged
generall merged 5 commits intodevfrom
optimizations-endpoint-single-list
Jan 26, 2026
Merged

Update GET collections/{}/optimizations#7946
generall merged 5 commits intodevfrom
optimizations-endpoint-single-list

Conversation

@xzfc
Copy link
Copy Markdown
Member

@xzfc xzfc commented Jan 20, 2026

This PR rehauls /collections/{}/optimizations endpoint.

  • Now this endpoint contains the following fields:
    • summary (replaces old summary in pending)
    • running (was ongoing) - list
    • queued (new) - list, predicted by OptimizerPlanner
    • completed - list
    • idle_segments (new) - list of good segments that don't require optimizations
  • Previously, running/completed lists were containing naked ProgressTrees.
    • In this PR, they are wrapped with additional meta-information.
    • uuids are included to let the UI refresh currently selected progress tree.
    • The difference, illustrated:
       "running": [
      +  {
      +    "uuid": "b17f761d-be66-4cab-b931-3f631c746066",
      +    "segments": [
      +      {"uuid": "ea103d7a-f379-4b37-814c-9f8b6400c321", "points_count": 12345}
      +    ],
      +    "optimizer": "indexing",
      +    "status": "optimizing",
      +    "progress":
             { /* progress tree */ },
      +  }
       ]
  • New query parameter ?with to control whether to include new optional fields.
    • To include all fields, use ?with=queued,completed,idlle_segments.
    • Why: these lists might be very chunky.
    • Why running is not optional: if we need just a single number of current optimizations, then we can add this number it to GET /collections/{} endpoint.
    • The old parameter ?completed=true is replaced with ?with=completed.
  • Use-case for OptimizationSegmentInfo (idle_segments[], queued[].segments[], running[].segments[]):
    The UI might visualize the collection as a bunch of rectangles; with color/size based on the status/points count. (perhaps it might look like the old defrag) UUIDs can help keep ordering/transitions.

Example output:

{
  "summary": {
    "queued_optimizations": 8,
    "queued_segments": 8,
    "queued_points": 50400,
    "idle_segments": 8
  },

  "running": [
    {
      "uuid": "9254c533-f78e-4b14-9935-593ef2bc8519",
      "optimizer": "indexing",
      "status": "optimizing",
      "segments": [
        {"uuid": "bfcd34c7-eebd-47b1-a30e-781ac2a28dc7", "points_count": 6300}
      ],
      "progress": { /* progress */ }
    },
    /* … */
  ],

  "queued": [
    {
      "optimizer": "indexing",
      "segments": [
        {"uuid": "95da2479-48d5-48a3-bfb9-a89f2a9a1c7f", "points_count": 6300}
      ]
    },
    /* … */
  ],

  "completed": [
    {
      "uuid": "8f7a3e39-e96f-4e8d-aad5-3d04eddd08f0",
      "optimizer": "indexing",
      "status": "done",
      "segments": [
        {"uuid": "67a1160a-fdf0-4765-8f77-d941dddb218b", "points_count": 6332}
      ],
    },
    /* … */
  ],

  "idle_segments": [
    {"uuid": "fbc4e2f0-763c-4a07-9763-74b91bf06419", "points_count": 5060},
    {"uuid": "852914c0-3267-4eba-b4f0-41a0b97fab04", "points_count": 7260},
    {"uuid": "01573268-2b43-4959-98be-faeca6c39582", "points_count": 7024},
    /* … */
  ]
}

@xzfc xzfc marked this pull request as draft January 20, 2026 02:41
@xzfc xzfc force-pushed the optimizations-endpoint-single-list branch from 21a2231 to 8caaebe Compare January 20, 2026 02:47
Base automatically changed from optimizations-endpoint-re-plan to dev January 20, 2026 10:07
@xzfc xzfc mentioned this pull request Jan 21, 2026
@xzfc xzfc force-pushed the optimizations-endpoint-single-list branch from 8caaebe to 8385d8c Compare January 23, 2026 11:32
@xzfc xzfc changed the title GET /optimizations: unify ongoing and completed into a single list Update GET collections/{}/optimizations Jan 23, 2026
@xzfc xzfc marked this pull request as ready for review January 23, 2026 12:03
@qdrant qdrant deleted a comment from coderabbitai Bot Jan 23, 2026
Copy link
Copy Markdown
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

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

👍

The parameterization makes it feel like we're inventing some kind of GraphQL here. Though I believe it is well placed here, and I don't have a better suggestion. I understand the benefit for web UI if this endpoint is being refreshed a lot.

Comment thread src/actix/api/collections_api.rs Outdated
coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai Bot Jan 26, 2026
@generall generall merged commit d7a0f2f into dev Jan 26, 2026
15 checks passed
@generall generall deleted the optimizations-endpoint-single-list branch January 26, 2026 17:03
IvanPleshkov pushed a commit that referenced this pull request Jan 27, 2026
* refactor(SegmentOptimizer::name): make it `&'static`

* refactor(TrackerStatus): add is_running()

* refactor: add TrackerSegmentInfo

* feat: rework optimizations endpoint

* feat(collections/{}/optimizations): trim spaces
@generall generall added this to the Optimization Progress milestone Feb 9, 2026
generall pushed a commit that referenced this pull request Feb 9, 2026
* refactor(SegmentOptimizer::name): make it `&'static`

* refactor(TrackerStatus): add is_running()

* refactor: add TrackerSegmentInfo

* feat: rework optimizations endpoint

* feat(collections/{}/optimizations): trim spaces
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* refactor(SegmentOptimizer::name): make it `&'static`

* refactor(TrackerStatus): add is_running()

* refactor: add TrackerSegmentInfo

* feat: rework optimizations endpoint

* feat(collections/{}/optimizations): trim spaces
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.

3 participants