{"id":19621611,"url":"https://github.com/pkg6/think-elasticsearch","last_synced_at":"2025-07-21T10:32:04.287Z","repository":{"id":65523210,"uuid":"586238233","full_name":"pkg6/think-elasticsearch","owner":"pkg6","description":"An easy way to use the official PHP ElasticSearch client in your thinkphp applications.","archived":false,"fork":false,"pushed_at":"2023-01-07T12:42:22.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-05T19:57:33.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pkg6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-07T12:40:24.000Z","updated_at":"2023-01-07T12:41:20.000Z","dependencies_parsed_at":"2023-02-07T04:32:41.895Z","dependency_job_id":null,"html_url":"https://github.com/pkg6/think-elasticsearch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pkg6/think-elasticsearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fthink-elasticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fthink-elasticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fthink-elasticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fthink-elasticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkg6","download_url":"https://codeload.github.com/pkg6/think-elasticsearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fthink-elasticsearch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266285373,"owners_count":23905331,"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","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":[],"created_at":"2024-11-11T11:23:43.757Z","updated_at":"2025-07-21T10:32:04.253Z","avatar_url":"https://github.com/pkg6.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 安装\n\n```shell\ncomposer require tp5er/think-elasticsearch\n```\n\n## 基本配置\n\n```ini\nELASTICSEARCH_HOST=localhost\nELASTICSEARCH_PORT=9200\nELASTICSEARCH_SCHEME=http\nELASTICSEARCH_USER=\nELASTICSEARCH_PASS=\n```\n\n## 常规使用\n\n\u003e $data = [\n\u003e     'body' =\u003e [\n\u003e         'testField' =\u003e 'abc'\n\u003e     ],\n\u003e     'index' =\u003e 'my_index',\n\u003e     'type' =\u003e 'my_type',\n\u003e     'id' =\u003e 'my_id',\n\u003e ];\n\u003e\n\u003e $client = ClientBuilder::create()-\u003ebuild();\n\u003e $return = $client-\u003eindex($data);\n\n您现在可以简单地替换最后两行：\n\n```php\n$return = \\tp5er\\think\\elasticsearch\\Elasticsearch::index($data);\n```\n\n这将在默认连接上运行命令。 你可以运行一个命令\n任何连接（参见 `defaultConnection` 设置和 `connections` 数组\n配置文件）。\n\n```php\n$return = \\tp5er\\think\\elasticsearch\\Elasticsearch::connection('connectionName')-\u003eindex($data);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fthink-elasticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkg6%2Fthink-elasticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fthink-elasticsearch/lists"}