paginate to get total active docs count

pull/612/head
Simon 8 months ago
parent 463019ce5a
commit 4a145ee7cb
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

@ -105,11 +105,13 @@ class ReindexPopulate(ReindexBase):
"""get total hits from index""" """get total hits from index"""
index_name = reindex_config["index_name"] index_name = reindex_config["index_name"]
active_key = reindex_config["active_key"] active_key = reindex_config["active_key"]
path = f"{index_name}/_search?filter_path=hits.total" data = {
data = {"query": {"match": {active_key: True}}} "query": {"term": {active_key: {"value": True}}},
response, _ = ElasticWrap(path).post(data=data) "_source": False,
total_hits = response["hits"]["total"]["value"] }
return total_hits total = IndexPaginate(index_name, data, keep_source=True).get_results()
return len(total)
def _get_daily_should(self, total_hits): def _get_daily_should(self, total_hits):
"""calc how many should reindex daily""" """calc how many should reindex daily"""

Loading…
Cancel
Save