-
Notifications
You must be signed in to change notification settings - Fork 982
ESQL query builder prototype #1462
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
base: main
Are you sure you want to change the base?
Conversation
@miguelgrinberg thanks for the PR it looks interesting. The only comment that I've at the moment is to split each class in a separate file. The name of the file must be the same of the class. This is a best practices in PHP . |
@ezimuel I refactored into multiple files (one per class) and added a couple more commands now. Let me know if this structure seems reasonable and I'll add the remaining commands and all the docs. Two usage examples: use Elastic\Elasticsearch\Helper\Esql;
$query = Esql\Query::from("books", "books*")
->where('author == "King"', 'year == 1982')
->limit(10);
echo $query;
$query = Esql\Query::row(a: 123, b: "test")
->limit(1);
echo $query; |
f1feaca
to
82ae0fe
Compare
b54a783
to
c602ff7
Compare
c602ff7
to
85f63cc
Compare
@ezimuel This is ready to review! Maybe what makes the most sense is for you to read the unit test file first, so that you see how all the commands are constructed. |
c586cb8
to
bee8abb
Compare
e3c1282
to
491b3b2
Compare
This PR contains a prototype of an ES|QL query builder feature for the PHP client based on the one I built for the Python client.
Example usage:
Output:
In IDEs, you get correct suggestions based on context. For example: