summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpython/fatcat_ingest.py1
-rw-r--r--python/fatcat_web/search.py11
2 files changed, 12 insertions, 0 deletions
diff --git a/python/fatcat_ingest.py b/python/fatcat_ingest.py
index b9d71a7c..f1139a28 100755
--- a/python/fatcat_ingest.py
+++ b/python/fatcat_ingest.py
@@ -28,6 +28,7 @@ def _init_search(args):
client = elasticsearch.Elasticsearch(args.elasticsearch_endpoint)
search = Search(using=client, index=args.elasticsearch_index)
+ search = search.params(track_total_hits=True)
return search
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index 2811b9a0..94c7431c 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -292,6 +292,7 @@ def get_elastic_container_random_releases(ident: str, limit=5) -> dict:
search = search[:int(limit)]
search = search.params(request_cache=True)
+ # not needed: search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
results = results_to_dict(resp)
@@ -319,6 +320,7 @@ def get_elastic_entity_stats() -> dict:
search = search[:0] # pylint: disable=unsubscriptable-object
search = search.params(request_cache=True)
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
stats['release'] = {
@@ -353,6 +355,7 @@ def get_elastic_entity_stats() -> dict:
search = search[:0]
search = search.params(request_cache=True)
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.paper_like.buckets
stats['papers'] = {
@@ -373,6 +376,7 @@ def get_elastic_entity_stats() -> dict:
search = search[:0] # pylint: disable=unsubscriptable-object
search = search.params(request_cache=True)
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
stats['container'] = {
"total": _hits_total_int(resp.hits.total),
@@ -407,6 +411,7 @@ def get_elastic_search_coverage(query: ReleaseQuery) -> dict:
search = search[:0]
search = search.params(request_cache=True)
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
preservation_bucket = agg_to_dict(resp.aggregations.preservation)
@@ -478,6 +483,7 @@ def get_elastic_container_stats(ident, issnl=None, es_client=None, es_index=None
search = search[:0]
search = search.params(request_cache=True)
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
container_stats = resp.aggregations.container_stats.buckets
@@ -551,6 +557,7 @@ def get_elastic_container_histogram_legacy(ident) -> List:
search = search[:0]
search = search.params(request_cache='true')
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.year_in_ia.buckets
@@ -618,6 +625,7 @@ def get_elastic_preservation_by_year(query) -> List[dict]:
)
search = search[:0]
search = search.params(request_cache='true')
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.year_preservation.buckets
@@ -695,6 +703,7 @@ def get_elastic_preservation_by_date(query) -> List[dict]:
)
search = search[:0]
search = search.params(request_cache='true')
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.date_preservation.buckets
@@ -752,6 +761,7 @@ def get_elastic_container_preservation_by_volume(container_id: str) -> List[dict
)
search = search[:0]
search = search.params(request_cache='true')
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.volume_preservation.buckets
@@ -824,6 +834,7 @@ def get_elastic_preservation_by_type(query: ReleaseQuery) -> List[dict]:
)
search = search[:0]
search = search.params(request_cache='true')
+ search = search.params(track_total_hits=True)
resp = wrap_es_execution(search)
buckets = resp.aggregations.type_preservation.buckets