{"id":15698504,"url":"https://github.com/gskema/elasticsearch-query-dsl-php","last_synced_at":"2025-10-13T00:14:12.317Z","repository":{"id":62513077,"uuid":"121800987","full_name":"gskema/elasticsearch-query-dsl-php","owner":"gskema","description":"Feature complete, object oriented, composable, extendable ElasticSearch query DSL builder for PHP","archived":false,"fork":false,"pushed_at":"2024-01-29T12:04:02.000Z","size":392,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"6.x","last_synced_at":"2025-10-13T00:14:11.123Z","etag":null,"topics":["dsl","elasticsearch","php","query"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gskema.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-16T21:09:16.000Z","updated_at":"2024-12-22T03:25:24.000Z","dependencies_parsed_at":"2023-12-27T00:22:38.996Z","dependency_job_id":"2217bcce-8e46-4cfa-a53c-26df2b8ff2c1","html_url":"https://github.com/gskema/elasticsearch-query-dsl-php","commit_stats":{"total_commits":93,"total_committers":2,"mean_commits":46.5,"dds":"0.043010752688172005","last_synced_commit":"e2dc88697bd307965194ee69448d0023eca0ef8c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gskema/elasticsearch-query-dsl-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskema%2Felasticsearch-query-dsl-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskema%2Felasticsearch-query-dsl-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskema%2Felasticsearch-query-dsl-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskema%2Felasticsearch-query-dsl-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gskema","download_url":"https://codeload.github.com/gskema/elasticsearch-query-dsl-php/tar.gz/refs/heads/6.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskema%2Felasticsearch-query-dsl-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013618,"owners_count":26085298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","elasticsearch","php","query"],"created_at":"2024-10-03T19:29:00.940Z","updated_at":"2025-10-13T00:14:12.301Z","avatar_url":"https://github.com/gskema.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elasticsearch Query DSL\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-build]][link-build]\n[![Coverage Status][ico-coverage]][link-build]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nFeature complete, object oriented, composable, extendable Elasticsearch query DSL builder for PHP.\n\n## Features\n\n- Dependency free\n- Can be used with any PHP Elasticsearch client\n- Fully interfaced, ready for custom classes and \n- Explicit class and property naming, fully matches produced JSON and Elasticsearch docs\n- All configuration options are listed inside classes, links to documentation\n- Classes can be easily composed, extended\n- Usage of setters/getters so that everything can be inlined and chained.\n- Fully working `::__clone()` methods\n- Extendable code: no usage of `private`, `final` or `readonly`\n- Basic objects created on `__construct`, no unnecessary body build logic until `jsonSerialize()` is called\n\n## Versions\n\nMost of the classes should be compatible with any Elasticsearch versions.\nIf something is not compatible or not supported, `Raw*` or custom classes can be used.\n\n| Package version | Elasticsearch version |\n|-----------------|-----------------------|\n| \u003e=6.0.0 \u003c7.0.0  | \u003e=6.0.0 \u003c7.0.0        |\n| \u003e=5.0.0 \u003c6.0.0  | \u003e=5.0.0 \u003c6.0.0        |\n\nBecause major version number follows Elasticsearch major version number, second number is reserved for breaking changes.\n\n## Install\n\n``` bash\ncomposer require gskema/elasticsearch-query-dsl-php 6.* # match your Elasticsearch version\n```\n\n## Usage\n\n``` php\n$searchRequest = new SearchRequest();\n$searchRequest-\u003esetOption('min_score', 3.5);\n$searchRequest-\u003esetSize(10);\n$searchRequest-\u003esetQuery(\n    (new BoolMatcher())-\u003eaddMustNot(new TermMatcher('field1', 'value1'))\n);\n$searchRequest-\u003eaddStatGroup('stat_group_1');\n$searchRequest-\u003esetAgg(\n    'agg1',\n    (new FilterAggregation(new MatchAllMatcher()))\n        -\u003esetAgg('agg2', TermsAggregation::fromField('field2', 'value2'))\n);\n\n(new ElasticsearchClient())-\u003esearch($searchRequest-\u003ejsonSerialize());\n```\n\nAll classes match naming in official Elasticsearch documentation.\nEach class has a list of possible configuration options listed above\nclass using attributes:\n\n```php\n#[Options([\n    'flags' =\u003e 'ALL|ANYSTRING|COMPLEMENT|EMPTY|INTERSECTION|INTERVAL|NONE',\n    'max_determinized_states' =\u003e 2000,\n    ...\n])]\nclass RegexpMatcher implements MultiTermMatcherInterface {}\n```\n\nSimilarly, `SearchRequest` class also has possible URL parameters listed:\n\n```php\n#[Parameters([\n    'timeout' =\u003e '2s',\n    'terminate_after' =\u003e 1,\n    'max_concurrent_shard_requests' =\u003e 2,\n    ...\n])]\nclass SearchRequest implements SearchRequestInterface {}\n```\n\n## Matcher?\n\nRequest object that is received by Elasticsearch `/_search/` has many properties and sub-properties\nlike `query`, `filter`, `post_filter`, etc.\n\nTo avoid convoluted expressions like\n```php\n(new SearchRequest())-\u003esetQuery(\n    (new BoolQuery()-\u003eaddFilter(new TermQuery('x')\n)-\u003esetPostFilter(new BoolQuery(...)))\n```\nkeyword `matcher` was explicitly chosen.\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n./vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/gskema/elasticsearch-query-dsl-php.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-build]: https://img.shields.io/github/actions/workflow/status/gskema/elasticsearch-query-dsl-php/ci.yml?branch=6.x\n[ico-coverage]: https://raw.githubusercontent.com/gskema/elasticsearch-query-dsl-php/image-data/coverage.svg\n[ico-downloads]: https://img.shields.io/packagist/dt/gskema/elasticsearch-query-dsl-php.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/gskema/elasticsearch-query-dsl-php\n[link-build]: https://github.com/gskema/elasticsearch-query-dsl-php/actions\n[link-downloads]: https://packagist.org/packages/gskema/elasticsearch-query-dsl-php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskema%2Felasticsearch-query-dsl-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgskema%2Felasticsearch-query-dsl-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskema%2Felasticsearch-query-dsl-php/lists"}