Skip to content

Commit

Permalink
Reduce max bulk index size, apply configured general ES timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Sep 26, 2024
1 parent 8c1abdc commit 594156c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Tekst-API/tekst/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class ElasticsearchConfig(ConfigSubSection):
port: int = 9200
prefix: str = "tekst"
timeout_init_s: int = 240
timeout_general_s: int = 30
timeout_general_s: int = 60
timeout_search_s: str = "30s"
max_field_mappings: int = 1000

Expand Down
4 changes: 2 additions & 2 deletions Tekst-API/tekst/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ async def _populate_index(
if text is None:
raise ValueError("text is None!")
client: Elasticsearch = await _get_es_client()
bulk_index_max_size = 250
bulk_index_max_size = 100
bulk_index_body = []
errors = False
target_resource_ids = [
Expand Down Expand Up @@ -312,7 +312,7 @@ def _bulk_index(
reqest_body: dict[str, Any],
req_no: int = None,
) -> bool:
resp = client.bulk(body=reqest_body)
resp = client.bulk(body=reqest_body, timeout=f"{_cfg.es.timeout_general_s}s")
req_no_str = f"#{req_no} " if req_no is not None else ""
log.debug(f"Bulk index request {req_no_str}took: {resp.get('took', '???')}ms")
return bool(resp) and not resp.get("errors", False)
Expand Down

0 comments on commit 594156c

Please sign in to comment.