Skip to content

[SDBELGA-1056] Add get_all_batch_elastic to Eve resource service#3172

Merged
MarkLark86 merged 5 commits intosuperdesk:release/2.11from
MarkLark86:SDBELGA-1056
Mar 18, 2026
Merged

[SDBELGA-1056] Add get_all_batch_elastic to Eve resource service#3172
MarkLark86 merged 5 commits intosuperdesk:release/2.11from
MarkLark86:SDBELGA-1056

Conversation

@MarkLark86
Copy link
Copy Markdown
Contributor

Purpose

We didn't have a way to iterate, in batches, items in Elasticsearch. The only way to do it was manually, and using the from and to params (which is not advisable on large indexes). The current workaround for the ProdAPI/Events endpoint is to use size=10_000 which is not ideal.

What has changed

  • Add a new method get_all_batch_elastic to the Eve resource service

Resolves: SDBELGA-1056

@MarkLark86 MarkLark86 added this to the 2.11.2 milestone Mar 17, 2026
@MarkLark86 MarkLark86 requested a review from petrjasek March 17, 2026 02:28
@petrjasek petrjasek requested a review from Copilot March 17, 2026 07:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Elasticsearch-backed batch iterator to the Eve resource service to support efficient full-index iteration without using from/to pagination.

Changes:

  • Introduced get_all_batch_elastic() on the resource service using search_after pagination.
  • Added a raw-search path (search_raw) in the Eve backend to bypass resource-specific filters when needed.
  • Added datalayer tests covering batch iteration and query filtering via Elasticsearch.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tests/datalayer_tests.py Adds tests for the new get_all_batch_elastic batch iterator (including lookup filtering).
superdesk/services.py Implements get_all_batch_elastic() using Elasticsearch search_after pagination.
superdesk/eve_backend.py Adds search_raw() to access the Elasticsearch backend without resource-specific filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread superdesk/services.py Outdated
Comment thread superdesk/services.py Outdated
Comment thread superdesk/services.py Outdated
Comment thread superdesk/services.py
Comment thread superdesk/eve_backend.py Outdated
@MarkLark86 MarkLark86 merged commit 9960ed6 into superdesk:release/2.11 Mar 18, 2026
14 of 16 checks passed
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