Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESQL operator #1791

Merged
merged 5 commits into from
Oct 18, 2023
Merged

Add ESQL operator #1791

merged 5 commits into from
Oct 18, 2023

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Oct 15, 2023

This pull request introduces the ES|QL operator. This operator, for now, supports only two main parameters: query and filter.

@dnhatn dnhatn marked this pull request as ready for review October 16, 2023 00:34
@dnhatn dnhatn requested review from b-deam and gbanasiak October 16, 2023 04:16
@dnhatn
Copy link
Member Author

dnhatn commented Oct 16, 2023

/cc @craigtaverner

esrally/track/track.py Outdated Show resolved Hide resolved
@dnhatn dnhatn requested a review from b-deam October 16, 2023 05:19
@@ -2829,6 +2830,23 @@ def __repr__(self, *args, **kwargs):
return "field-caps"


class Esql(Runner):
async def __call__(self, es, params):
Copy link
Member

Choose a reason for hiding this comment

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

There are a couple of high level properties that operations should expose, namely:

  • request-timeout
  • headers
  • opaque-id

You can add support for these by using the Runner._transport_request_params helper method:

def _transport_request_params(params):
"""
Takes all of a runner's params and splits out request parameters, transport
level parameters, and headers into their own respective dicts.
:param params: A hash with all the respective runner's parameters.
:return: A tuple of the specific runner's params, request level parameters, transport level parameters, and headers, respectively.
"""
transport_params = {}
request_params = params.get("request-params", {})
if request_timeout := params.pop("request-timeout", None):
transport_params["request_timeout"] = request_timeout
if (ignore_status := request_params.pop("ignore", None)) or (ignore_status := params.pop("ignore", None)):
transport_params["ignore_status"] = ignore_status
headers = params.pop("headers", None) or {}
if opaque_id := params.pop("opaque-id", None):
headers.update({"x-opaque-id": opaque_id})
return params, request_params, transport_params, headers

An example of usage:

params, request_params, transport_params, headers = self._transport_request_params(params)

Copy link
Member

@b-deam b-deam left a comment

Choose a reason for hiding this comment

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

LGTM. I left one comment about using a helper method around configuring the different request, transport, and header parameters but no need for another review.

@dnhatn
Copy link
Member Author

dnhatn commented Oct 18, 2023

@b-deam @gbanasiak Thanks for reviews.

@dnhatn dnhatn enabled auto-merge (squash) October 18, 2023 03:40
@dnhatn dnhatn disabled auto-merge October 18, 2023 03:40
@dnhatn dnhatn enabled auto-merge (squash) October 18, 2023 03:41
@dnhatn
Copy link
Member Author

dnhatn commented Oct 18, 2023

@elasticmachine run rally/it-python310 please

@dnhatn dnhatn merged commit d82295a into elastic:master Oct 18, 2023
11 checks passed

* ``query`` (mandatory): An ES|QL query starts with a source command followed processing commands.
* ``filter`` (optional): A query filter defined in `Elasticsearch query DSL <https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html>`_.
* ``body`` (optional): The query body.

Choose a reason for hiding this comment

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

The description here should indicate that this is used for anything additions to put into the body, since the query will already be placed there. For example, we use this for pragma.

@gbanasiak gbanasiak added this to the 2.10.0 milestone Oct 18, 2023
@dnhatn dnhatn deleted the esql-operator branch October 18, 2023 14:26
@gbanasiak gbanasiak added the enhancement Improves the status quo label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants