summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-25 17:13:14 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-25 17:13:14 -0800
commit5aed3803affdb3f05b881cb90496180be45da440 (patch)
tree5a4de19de020ad063f5f85219ad24851ed7373c7 /fatcat_scholar
parent3340910073bca6483937ed6d9e5f5b5942833c2e (diff)
downloadfatcat-scholar-5aed3803affdb3f05b881cb90496180be45da440.tar.gz
fatcat-scholar-5aed3803affdb3f05b881cb90496180be45da440.zip
refactor ES configuration setting names
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/issue_db.py2
-rw-r--r--fatcat_scholar/query_citation.py2
-rw-r--r--fatcat_scholar/query_fatcat.py4
-rw-r--r--fatcat_scholar/search.py4
-rw-r--r--fatcat_scholar/templates/search_macros.html2
-rw-r--r--fatcat_scholar/worker.py4
6 files changed, 9 insertions, 9 deletions
diff --git a/fatcat_scholar/issue_db.py b/fatcat_scholar/issue_db.py
index bf79b09..e01c6d9 100644
--- a/fatcat_scholar/issue_db.py
+++ b/fatcat_scholar/issue_db.py
@@ -426,7 +426,7 @@ def main() -> None:
api_conf = fatcat_openapi_client.Configuration()
api_conf.host = settings.FATCAT_API_HOST
api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(api_conf))
- es_client = elasticsearch.Elasticsearch(settings.FATCAT_ELASTICSEARCH_BACKEND)
+ es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_FATCAT_BASE)
if args.func == "load_pubs":
idb.load_pubs(args.json_file, api)
diff --git a/fatcat_scholar/query_citation.py b/fatcat_scholar/query_citation.py
index c555fd4..21f4a9c 100644
--- a/fatcat_scholar/query_citation.py
+++ b/fatcat_scholar/query_citation.py
@@ -188,7 +188,7 @@ if __name__ == "__main__":
release = ref_to_release(ref)
print(release)
- es_backend = os.environ.get("ELASTICSEARCH_BACKEND", "https://search.fatcat.wiki")
+ es_backend = os.environ.get("ELASTICSEARCH_FATCAT_BASE", "https://search.fatcat.wiki")
es_client = elasticsearch.Elasticsearch(es_backend)
api_conf = fatcat_openapi_client.Configuration()
api_conf.host = os.environ.get("FATCAT_API_HOST", "https://api.fatcat.wiki/v0")
diff --git a/fatcat_scholar/query_fatcat.py b/fatcat_scholar/query_fatcat.py
index c862bc0..0f5347b 100644
--- a/fatcat_scholar/query_fatcat.py
+++ b/fatcat_scholar/query_fatcat.py
@@ -44,8 +44,8 @@ def run_query_fatcat(query: str, fulltext_only: bool, json_output: Any) -> None:
"""
api_session = requests_retry_session()
- es_backend = os.environ.get("ELASTICSEARCH_BACKEND", "https://search.fatcat.wiki")
- es_index = "fatcat_release"
+ es_backend = os.environ.get("ELASTICSEARCH_FATCAT_BASE", "https://search.fatcat.wiki")
+ es_index = os.environ.get("ELASTICSEARCH_FATCAT_RELEASE_INDEX", "fatcat_release")
es_client = elasticsearch.Elasticsearch(es_backend)
search = Search(using=es_client, index=es_index)
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 600745f..c75ccdb 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -97,7 +97,7 @@ class FulltextHits(BaseModel):
# global sync client connection
-es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_BACKEND, timeout=25.0)
+es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_QUERY_BASE, timeout=25.0)
def transform_es_results(resp: Response) -> List[dict]:
@@ -281,7 +281,7 @@ def do_fulltext_search(
query: FulltextQuery, deep_page_limit: int = 2000
) -> FulltextHits:
- search = Search(using=es_client, index=settings.ELASTICSEARCH_FULLTEXT_INDEX)
+ search = Search(using=es_client, index=settings.ELASTICSEARCH_QUERY_FULLTEXT_INDEX)
if query.collapse_key:
search = search.filter("term", collapse_key=query.collapse_key)
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html
index 6c7cb56..0f43142 100644
--- a/fatcat_scholar/templates/search_macros.html
+++ b/fatcat_scholar/templates/search_macros.html
@@ -392,7 +392,7 @@
{# TODO: remove doc for ES 7.x-style lack of type #}
{# TODO: only show 'json' link if from cluster? #}
{% if debug_mode %}
- <a target="_blank" rel="noopener" href="{{ settings.ELASTICSEARCH_FRONTEND }}/{{ settings.ELASTICSEARCH_FULLTEXT_INDEX }}/_doc/{{ paper.key }}">
+ <a target="_blank" rel="noopener" href="{{ settings.ELASTICSEARCH_PUBLIC_URL }}/{{ settings.ELASTICSEARCH_QUERY_FULLTEXT_INDEX }}/_doc/{{ paper.key }}">
<span class="ui label small" title="search document JSON debug link">json</span>
</a>
{% endif %}
diff --git a/fatcat_scholar/worker.py b/fatcat_scholar/worker.py
index 78b54d4..fb806a7 100644
--- a/fatcat_scholar/worker.py
+++ b/fatcat_scholar/worker.py
@@ -227,7 +227,7 @@ def main() -> None:
fdw.run()
elif args.worker == "index-docs-worker":
es_client = elasticsearch.Elasticsearch(
- settings.ELASTICSEARCH_BACKEND, timeout=25.0
+ settings.ELASTICSEARCH_WRITE_BASE, timeout=25.0
)
idw = IndexDocsWorker(
kafka_brokers=settings.KAFKA_BROKERS,
@@ -235,7 +235,7 @@ def main() -> None:
consume_topics=[f"scholar-{settings.SCHOLAR_ENV}.update-docs"],
consumer_group=f"scholar-{settings.SCHOLAR_ENV}-index-workers",
es_client=es_client,
- es_index=settings.ELASTICSEARCH_FULLTEXT_INDEX,
+ es_index=settings.ELASTICSEARCH_WRITE_FULLTEXT_INDEX,
)
idw.run()