Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions connector_elasticsearch/models/se_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ class SeBackend(models.Model):
default=True,
help="Verify SSL certificates. Only set to False in development environments.",
)
es_timeout = fields.Integer(
string="Elasticsearch timeout",
default=10,
help="Elastic Search request timeout",
)
es_max_retries = fields.Integer(
string="Elasticsearch max retries",
default=0,
help="Number of retries, when an occurs. "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oups

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"0 or negative means no retries and the exception is raised.",
)
es_retry_on_timeout = fields.Boolean(
string="Elasticsearch retry on timeout",
help="If set, retry when a connection timeout occurs. "
"Otherwise, the retries are only on other errors",
)

@property
def _server_env_fields(self):
Expand Down
3 changes: 3 additions & 0 deletions connector_elasticsearch/tools/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def _get_es_client(self):
[backend.es_server_host],
connection_class=self._es_connection_class,
api_key=api_key,
timeout=max(backend.es_timeout, 1),
retry_on_timeout=backend.es_retry_on_timeout,
max_retries=max(0, backend.es_max_retries),
)
if backend.auth_type == "http":
auth = (backend.es_user, backend.es_password)
Expand Down
5 changes: 5 additions & 0 deletions connector_elasticsearch/views/se_backend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
attrs="{'invisible': [('auth_type', '!=', 'api_key')]}"
/>
</group>
<group name="se-params">
<field string="Max retries" name="es_max_retries" />
<field string="Retry on timeout" name="es_retry_on_timeout" />
<field string="Timeout" name="es_timeout" />
</group>
</group>
</field>
</record>
Expand Down