Skip to content

Commit

Permalink
Merge branch 'opensearch_pagination' of 'https://github.com/zhquan/Gr…
Browse files Browse the repository at this point in the history
…imoireELK'

Merges #1167
Closes #1167
  • Loading branch information
zhquan committed Sep 4, 2024
2 parents d903568 + 252772b commit 7e0095c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions grimoire_elk/elk.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,9 @@ def get_uuids_in_index(target_uuids):
)

hits = []
if page['hits']['total'] != 0:
total = page['hits']['total']
total_value = total['value'] if isinstance(total, dict) else total
if total_value != 0:
hits = page['hits']['hits']

return hits
Expand Down Expand Up @@ -810,7 +812,8 @@ def delete_inactive_unique_identities(es, sortinghat_db, before_date):
)

sid = page['_scroll_id']
scroll_size = page['hits']['total']
total = page['hits']['total']
scroll_size = total['value'] if isinstance(total, dict) else total

if scroll_size == 0:
logging.warning("[identities retention] No inactive identities found in {} after {}!".format(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Handle OpenSearch page info on pagination
category: fixed
author: Quan Zhou <quan@bitergia.com>
issue: null
notes: >
In OpenSearch and ElasticSearch < 7.x the page info on
pagination is different. This will handle both of them.

0 comments on commit 7e0095c

Please sign in to comment.