diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-04-09 15:02:46 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-04-09 15:02:46 -0700 |
commit | 0320f2ef339a3e74cddcb34516546493974a19c9 (patch) | |
tree | 86d4110eb3a4c4e50ef1d739b95b4d90d17456d7 /python/fatcat_web/search.py | |
parent | 016aa04273495940a17c6cc86d2fae6520f677fe (diff) | |
download | fatcat-0320f2ef339a3e74cddcb34516546493974a19c9.tar.gz fatcat-0320f2ef339a3e74cddcb34516546493974a19c9.zip |
search: more ES 7.x changes (track total counts)
Diffstat (limited to 'python/fatcat_web/search.py')
-rw-r--r-- | python/fatcat_web/search.py | 11 |
1 files changed, 11 insertions, 0 deletions
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 |