Skip to content

feature request - quit esql query by interrupt windows powershell #2758

Closed as not planned
@mortenb-buypass

Description

@mortenb-buypass

I find it hard to work on large indexes, seems like I'm unable to interrupt a query once it has fired.

But I'm unable to get <ctrl+c> or any interrupt to work:


class Esql:
    def __init__(self, env:str='test', timeout:int=60, timefield:str='time'):
        self.client = elasticsearch.Elasticsearch(hosts[env], request_timeout=timeout)
:
        try:
            response = self.client.esql.query(
                query=query, format=format
            )
        except (elasticsearch.exceptions.BadRequestError) as e:
            log.error(e)
            return None
        except (KeyboardInterrupt, SystemExit):
            log.error("interrupted")
            sys.exit(-1)
        except Exception as e:
            log.error(f"unmapped exception {e}")
            return None


20250121132640.032|INFO|C:\dist\elk\tools\esql.py:468|query: FROM bps-trace-* | WHERE @timestamp >= "2025-01-21T11:25:37.727Z" AND @timestamp <= "2025-01-21T12:25:37.728Z" | WHERE bps.application=="id-pro-trk-trk-fido2-service-test12" | KEEP `message`
20250121132713.958|ERROR|C:\dist\elk\tools\esql.py:284|interrupted

I get KeyboardInterrupt only after the query has returned after 23sec

And setting the request_timeout will exit if it reached the value.

A way to quit it at anytime would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions