-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ES|QL query builder #2997
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
ES|QL query builder #2997
Conversation
20c552a
to
54c7525
Compare
2c2b3f2
to
458fe7a
Compare
168ddef
to
c6537d8
Compare
b4b6da4
to
f87f3b5
Compare
f87f3b5
to
27d8977
Compare
🔍 Preview links for changed docs |
fce101d
to
01374fb
Compare
01374fb
to
c6fb3f9
Compare
@pquentin this PR is ready for review. There are currently two remaining items:
|
```python | ||
>>> from elasticsearch import Elasticsearch | ||
>>> client = Elasticsearch(hosts=[os.environ['ELASTICSEARCH_URL']]) | ||
>>> response = client.esql.query(query=str(query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what your thoughts are about being able to pass the query object directly here and have the conversion to string in the generated method. Maybe something we can think about for the future as an improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, and I don't think this can be a problem in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modified the Python client generator to allow this, so once we get that merged we can eliminate the requirement of converting the queries to strings. https://github.com/elastic/elastic-client-generator-python/pull/59.
c7fc780
to
9c48982
Compare
9c48982
to
1f783d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! But I'd love if someone could properly review the code in elasticsearch/dsl
.
```python | ||
>>> from elasticsearch import Elasticsearch | ||
>>> client = Elasticsearch(hosts=[os.environ['ELASTICSEARCH_URL']]) | ||
>>> response = client.esql.query(query=str(query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, and I don't think this can be a problem in the future
1ad6eb5
to
939c70b
Compare
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-2997-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9eadabb0486f92bdc37312f56acfd40e62ec6fcf
# Push it to GitHub
git push --set-upstream origin backport-2997-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19 Then, create a pull request where the |
* ES|QL query builder * add missing esql api documentation * add FORK command * initial attempt at generating all functions * unit tests * more operators * documentation * integration tests * add new COMPLETION command * show ES|QL in all docs examples * Docstring fixes * add technical preview warning (cherry picked from commit 9eadabb)
* ES|QL query builder * add missing esql api documentation * add FORK command * initial attempt at generating all functions * unit tests * more operators * documentation * integration tests * add new COMPLETION command * show ES|QL in all docs examples * Docstring fixes * add technical preview warning
* ES|QL query builder * add missing esql api documentation * add FORK command * initial attempt at generating all functions * unit tests * more operators * documentation * integration tests * add new COMPLETION command * show ES|QL in all docs examples * Docstring fixes * add technical preview warning (cherry picked from commit 9eadabb) Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
This PR adds a Python ES|QL query builder.