{"record":{"id":"10af23feb18b5e3a","repo":"pathwaycom/pathway","slug":"read-batch-size-must-be-positive","errorCode":null,"errorMessage":"read_batch_size must be positive","messagePattern":"read_batch_size must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/elasticsearch/__init__.py","lineNumber":330,"sourceCode":"        raise ValueError(\n            f\"timestamp_column {timestamp_column!r} is not present in the schema\"\n        )\n    if id_column not in column_names:\n        raise ValueError(f\"id_column {id_column!r} is not present in the schema\")\n    if schema.primary_key_columns():\n        raise ValueError(\n            \"Defining a primary key in the schema is not supported for \"\n            \"pw.io.elasticsearch.read. The connector keys the resulting table by \"\n            \"id_column. If you need to reindex the table by a different column, use \"\n            \"pw.Table.with_id_from() after reading.\"\n        )\n\n    max_transaction_duration_ms = round(\n        as_duration_seconds(max_transaction_duration, \"max_transaction_duration\") * 1000\n    )\n    poll_interval_ms = round(as_duration_seconds(poll_interval, \"poll_interval\") * 1000)\n    if read_batch_size <= 0:\n        raise ValueError(\"read_batch_size must be positive\")\n\n    data_storage = api.DataStorage(\n        storage_type=\"elasticsearch\",\n        mode=internal_connector_mode(mode),\n        elasticsearch_params=api.ElasticSearchParams(\n            host=host,\n            index_name=index_name,\n            auth=auth.engine_es_auth,\n        ),\n        elasticsearch_reader_params=api.ElasticSearchReaderParams(\n            timestamp_field=timestamp_column,\n            id_field=id_column,\n            max_transaction_duration_ms=max_transaction_duration_ms,\n            read_batch_size=read_batch_size,\n            poll_interval_ms=poll_interval_ms,\n        ),\n    )\n","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/elasticsearch/__init__.py#L312-L348","documentation":"Raised by pw.io.elasticsearch.read when read_batch_size is zero or negative. The batch size controls how many documents are fetched per scroll request and must be a positive integer.","triggerScenarios":"pw.io.elasticsearch.read(..., read_batch_size=0) or read_batch_size=-10, often via a config variable that defaulted to 0 or was computed from an expression that yielded a non-positive value.","commonSituations":"read_batch_size loaded from an environment variable or config file that is unset and defaults to 0; batch-size auto-tuning code that floors to 0 on small inputs.","solutions":["Pass a positive integer, e.g. read_batch_size=1000 (or simply omit the argument to use the default).","Validate/normalize config before the call: max(1, int(config.get(\"read_batch_size\", 1000)))."],"exampleFix":"# before\npw.io.elasticsearch.read(..., read_batch_size=int(os.environ.get(\"BATCH\", 0)))\n\n# after\npw.io.elasticsearch.read(..., read_batch_size=max(1, int(os.environ.get(\"BATCH\", 1000))))","handlingStrategy":"validation","validationCode":"read_batch_size = int(read_batch_size)\nif read_batch_size <= 0:\n    raise ValueError(\"read_batch_size must be a positive integer\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate numeric connector settings from config/env with explicit defaults: max(1, int(...)).","Fail fast on misconfig at startup rather than letting bad values reach the connector."],"tags":["elasticsearch","validation","config","connector"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}