{"id":13412408,"url":"https://github.com/olivere/elastic","last_synced_at":"2025-05-12T05:32:54.564Z","repository":{"id":5824190,"uuid":"7039626","full_name":"olivere/elastic","owner":"olivere","description":"Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch","archived":false,"fork":false,"pushed_at":"2024-08-08T07:48:39.000Z","size":8438,"stargazers_count":7472,"open_issues_count":114,"forks_count":1154,"subscribers_count":161,"default_branch":"release-branch.v7","last_synced_at":"2025-05-09T03:58:46.263Z","etag":null,"topics":["elasticsearch","go"],"latest_commit_sha":null,"homepage":"https://olivere.github.io/elastic/","language":"Go","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/olivere.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-3.0.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2012-12-06T17:15:33.000Z","updated_at":"2025-05-08T13:52:49.000Z","dependencies_parsed_at":"2022-07-14T05:40:32.763Z","dependency_job_id":"b297f5c6-0c1b-4dbc-b07a-bb7847a13636","html_url":"https://github.com/olivere/elastic","commit_stats":{"total_commits":1339,"total_committers":123,"mean_commits":"10.886178861788618","dds":"0.13442867811799852","last_synced_commit":"4cdb89f6e627228e7cb3b53e1b1ef8630cc71a0a"},"previous_names":[],"tags_count":326,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivere%2Felastic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivere%2Felastic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivere%2Felastic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivere%2Felastic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olivere","download_url":"https://codeload.github.com/olivere/elastic/tar.gz/refs/heads/release-branch.v7","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253511165,"owners_count":21919847,"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":["elasticsearch","go"],"created_at":"2024-07-30T20:01:24.333Z","updated_at":"2025-05-11T03:27:33.552Z","avatar_url":"https://github.com/olivere.png","language":"Go","readme":"# Elastic\n\n**This is a development branch that is actively being worked on. DO NOT USE IN PRODUCTION! If you want to use stable versions of Elastic, please use Go modules for the 7.x release (or later) or a dependency manager like [dep](https://github.com/golang/dep) for earlier releases.**\n\nElastic is an [Elasticsearch](http://www.elasticsearch.org/) client for the\n[Go](http://www.golang.org/) programming language.\n\n[![Build Status](https://github.com/olivere/elastic/workflows/Test/badge.svg)](https://github.com/olivere/elastic/actions)\n[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://pkg.go.dev/github.com/olivere/elastic/v7?tab=doc)\n[![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/olivere/elastic/master/LICENSE)\n\nSee the [wiki](https://github.com/olivere/elastic/wiki) for additional information about Elastic.\n\n\u003ca href=\"https://www.buymeacoffee.com/Bjd96U8fm\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\n## Releases\n\n**The release branches (e.g. [`release-branch.v7`](https://github.com/olivere/elastic/tree/release-branch.v7))\nare actively being worked on and can break at any time.\nIf you want to use stable versions of Elastic, please use Go modules.**\n\nHere's the version matrix:\n\nElasticsearch version | Elastic version  | Package URL | Remarks |\n----------------------|------------------|-------------|---------|\n7.x                   | 7.0              | [`github.com/olivere/elastic/v7`](https://github.com/olivere/elastic) ([source](https://github.com/olivere/elastic/tree/release-branch.v7) [doc](http://godoc.org/github.com/olivere/elastic)) | Use Go modules.\n6.x                   | 6.0              | [`github.com/olivere/elastic`](https://github.com/olivere/elastic) ([source](https://github.com/olivere/elastic/tree/release-branch.v6) [doc](http://godoc.org/github.com/olivere/elastic)) | Use a dependency manager (see below).\n5.x                   | 5.0              | [`gopkg.in/olivere/elastic.v5`](https://gopkg.in/olivere/elastic.v5) ([source](https://github.com/olivere/elastic/tree/release-branch.v5) [doc](http://godoc.org/gopkg.in/olivere/elastic.v5)) | Actively maintained.\n2.x                   | 3.0              | [`gopkg.in/olivere/elastic.v3`](https://gopkg.in/olivere/elastic.v3) ([source](https://github.com/olivere/elastic/tree/release-branch.v3) [doc](http://godoc.org/gopkg.in/olivere/elastic.v3)) | Deprecated. Please update.\n1.x                   | 2.0              | [`gopkg.in/olivere/elastic.v2`](https://gopkg.in/olivere/elastic.v2) ([source](https://github.com/olivere/elastic/tree/release-branch.v2) [doc](http://godoc.org/gopkg.in/olivere/elastic.v2)) | Deprecated. Please update.\n0.9-1.3               | 1.0              | [`gopkg.in/olivere/elastic.v1`](https://gopkg.in/olivere/elastic.v1) ([source](https://github.com/olivere/elastic/tree/release-branch.v1) [doc](http://godoc.org/gopkg.in/olivere/elastic.v1)) | Deprecated. Please update.\n\n**Example:**\n\nYou have installed Elasticsearch 7.0.0 and want to use Elastic.\nAs listed above, you should use Elastic 7.0 (code is in `release-branch.v7`).\n\nTo use the required version of Elastic in your application, you\nshould use [Go modules](https://github.com/golang/go/wiki/Modules)\nto manage dependencies. Make sure to use a version such as `7.0.0` or later.\n\nTo use Elastic, import:\n\n```go\nimport \"github.com/olivere/elastic/v7\"\n```\n\n### Elastic 7.0\n\nElastic 7.0 targets Elasticsearch 7.x which [was released on April 10th 2019](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/release-notes-7.0.0.html).\n\nAs always with major version, there are a lot of [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/release-notes-7.0.0.html#breaking-7.0.0).\nWe will use this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v7/CHANGELOG-7.0.md),\nas we already did in earlier (major) releases.\n\n### Elastic 6.0\n\nElastic 6.0 targets Elasticsearch 6.x which was [released on 14th November 2017](https://www.elastic.co/blog/elasticsearch-6-0-0-released).\n\nNotice that there are a lot of [breaking changes in Elasticsearch 6.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/breaking-changes-6.0.html)\nand we used this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v6/CHANGELOG-6.0.md)\nas we did in the transition from earlier versions of Elastic.\n\n### Elastic 5.0\n\nElastic 5.0 targets Elasticsearch 5.0.0 and later. Elasticsearch 5.0.0 was\n[released on 26th October 2016](https://www.elastic.co/blog/elasticsearch-5-0-0-released).\n\nNotice that there are will be a lot of [breaking changes in Elasticsearch 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking-changes-5.0.html)\nand we used this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v5/CHANGELOG-5.0.md)\nas we did in the transition from Elastic 2.0 (for Elasticsearch 1.x) to Elastic 3.0 (for Elasticsearch 2.x).\n\nFurthermore, the jump in version numbers will give us a chance to be in sync with the Elastic Stack.\n\n### Elastic 3.0\n\nElastic 3.0 targets Elasticsearch 2.x and is published via [`gopkg.in/olivere/elastic.v3`](https://gopkg.in/olivere/elastic.v3).\n\nElastic 3.0 will only get critical bug fixes. You should update to a recent version.\n\n### Elastic 2.0\n\nElastic 2.0 targets Elasticsearch 1.x and is published via [`gopkg.in/olivere/elastic.v2`](https://gopkg.in/olivere/elastic.v2).\n\nElastic 2.0 will only get critical bug fixes. You should update to a recent version.\n\n### Elastic 1.0\n\nElastic 1.0 is deprecated. You should really update Elasticsearch and Elastic\nto a recent version.\n\nHowever, if you cannot update for some reason, don't worry. Version 1.0 is\nstill available. All you need to do is go-get it and change your import path\nas described above.\n\n\n## Status\n\nWe use Elastic in production since 2012. Elastic is stable but the API changes\nnow and then. We strive for API compatibility.\nHowever, Elasticsearch sometimes introduces [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes.html)\nand we sometimes have to adapt.\n\nHaving said that, there have been no big API changes that required you\nto rewrite your application big time. More often than not it's renaming APIs\nand adding/removing features so that Elastic is in sync with Elasticsearch.\n\nElastic has been used in production starting with Elasticsearch 0.90 up to recent 7.x\nversions.\nWe recently switched to [GitHub Actions for testing](https://github.com/olivere/elastic/actions).\nBefore that, we used [Travis CI](https://travis-ci.org/olivere/elastic) successfully for years).\n\nElasticsearch has quite a few features. Most of them are implemented\nby Elastic. I add features and APIs as required. It's straightforward\nto implement missing pieces. I'm accepting pull requests :-)\n\nHaving said that, I hope you find the project useful.\n\n\n## Getting Started\n\nThe first thing you do is to create a [Client](https://github.com/olivere/elastic/blob/master/client.go).\nThe client connects to Elasticsearch on `http://127.0.0.1:9200` by default.\n\nYou typically create one client for your app. Here's a complete example of\ncreating a client, creating an index, adding a document, executing a search etc.\n\nAn example is available [here](https://olivere.github.io/elastic/).\n\nHere's a [link to a complete working example for v6](https://gist.github.com/olivere/e4a376b4783c0914e44ea4f745ce2ebf).\n\nHere are a few tips on how to get used to Elastic:\n\n1. Head over to the [Wiki](https://github.com/olivere/elastic/wiki) for detailed information and\n   topics like e.g. [how to add a middleware](https://github.com/olivere/elastic/wiki/HttpTransport)\n   or how to [connect to AWS](https://github.com/olivere/elastic/wiki/Using-with-AWS-Elasticsearch-Service).\n2. If you are unsure how to implement something, read the tests (all `_test.go` files).\n   They not only serve as a guard against changes, but also as a reference.\n3. The [recipes](https://github.com/olivere/elastic/tree/release-branch.v6/recipes)\n   contains small examples on how to implement something, e.g. bulk indexing, scrolling etc.\n\n\n## API Status\n\n### Document APIs\n\n- [x] Index API\n- [x] Get API\n- [x] Delete API\n- [x] Delete By Query API\n- [x] Update API\n- [x] Update By Query API\n- [x] Multi Get API\n- [x] Bulk API\n- [x] Reindex API\n- [x] Term Vectors\n- [x] Multi termvectors API\n\n### Search APIs\n\n- [x] Search\n- [x] Search Template\n- [ ] Multi Search Template\n- [x] Search Shards API\n- [x] Suggesters\n  - [x] Term Suggester\n  - [x] Phrase Suggester\n  - [x] Completion Suggester\n  - [x] Context Suggester\n- [x] Multi Search API\n- [x] Count API\n- [x] Validate API\n- [x] Explain API\n- [x] Profile API\n- [x] Field Capabilities API\n\n### Aggregations\n\n- Metrics Aggregations\n  - [x] Avg\n  - [ ] Boxplot (X-pack)\n  - [x] Cardinality\n  - [x] Extended Stats\n  - [x] Geo Bounds\n  - [x] Geo Centroid\n  - [x] Matrix stats\n  - [x] Max\n  - [x] Median absolute deviation\n  - [x] Min\n  - [x] Percentile Ranks\n  - [x] Percentiles\n  - [ ] Rate (X-pack)\n  - [ ] Scripted Metric\n  - [x] Stats\n  - [ ] String stats (X-pack)\n  - [x] Sum\n  - [ ] T-test (X-pack)\n  - [x] Top Hits\n  - [x] Top metrics (X-pack)\n  - [x] Value Count\n  - [x] Weighted avg\n- Bucket Aggregations\n  - [x] Adjacency Matrix\n  - [x] Auto-interval Date Histogram\n  - [x] Children\n  - [x] Composite\n  - [x] Date Histogram\n  - [x] Date Range\n  - [x] Diversified Sampler\n  - [x] Filter\n  - [x] Filters\n  - [x] Geo Distance\n  - [x] Geohash Grid\n  - [x] Geotile grid\n  - [x] Global\n  - [x] Histogram\n  - [x] IP Range\n  - [x] Missing\n  - [x] Nested\n  - [ ] Parent\n  - [x] Range\n  - [ ] Rare terms\n  - [x] Reverse Nested\n  - [x] Sampler\n  - [x] Significant Terms\n  - [x] Significant Text\n  - [x] Terms\n  - [ ] Variable width histogram\n- Pipeline Aggregations\n  - [x] Avg Bucket\n  - [x] Bucket Script\n  - [x] Bucket Selector\n  - [x] Bucket Sort\n  - [ ] Cumulative cardinality (X-pack)\n  - [x] Cumulative Sum\n  - [x] Derivative\n  - [ ] Extended Stats Bucket\n  - [ ] Inference bucket (X-pack)\n  - [x] Max Bucket\n  - [x] Min Bucket\n  - [x] Moving Average\n  - [x] Moving function\n  - [ ] Moving percentiles (X-pack)\n  - [ ] Normalize (X-pack)\n  - [x] Percentiles Bucket\n  - [x] Serial Differencing\n  - [x] Stats Bucket\n  - [x] Sum Bucket\n- [x] Aggregation Metadata\n\n### Indices APIs\n\n- [x] Create Index\n- [x] Delete Index\n- [x] Get Index\n- [x] Indices Exists\n- [x] Open / Close Index\n- [x] Shrink Index\n- [x] Rollover Index\n- [x] Put Mapping\n- [x] Get Mapping\n- [x] Get Field Mapping\n- [x] Types Exists\n- [x] Index Aliases\n- [x] Update Indices Settings\n- [x] Get Settings\n- [x] Analyze\n  - [x] Explain Analyze\n- [x] Index Templates\n- [x] Indices Stats\n- [x] Indices Segments\n- [ ] Indices Recovery\n- [ ] Indices Shard Stores\n- [x] Clear Cache\n- [x] Flush\n  - [x] Synced Flush\n- [x] Refresh\n- [x] Force Merge\n\n### Index Lifecycle Management APIs\n\n- [x] Create Policy\n- [x] Get Policy\n- [x] Delete Policy\n- [ ] Move to Step\n- [ ] Remove Policy\n- [ ] Retry Policy\n- [ ] Get Ilm Status\n- [ ] Explain Lifecycle\n- [ ] Start Ilm\n- [ ] Stop Ilm\n\n### cat APIs\n\n- [X] cat aliases\n- [X] cat allocation\n- [X] cat count\n- [X] cat fielddata\n- [X] cat health\n- [X] cat indices\n- [x] cat master\n- [ ] cat nodeattrs\n- [ ] cat nodes\n- [ ] cat pending tasks\n- [ ] cat plugins\n- [ ] cat recovery\n- [ ] cat repositories\n- [ ] cat thread pool\n- [ ] cat shards\n- [ ] cat segments\n- [X] cat snapshots\n- [ ] cat templates\n\n### Cluster APIs\n\n- [x] Cluster Health\n- [x] Cluster State\n- [x] Cluster Stats\n- [ ] Pending Cluster Tasks\n- [x] Cluster Reroute\n- [ ] Cluster Update Settings\n- [x] Nodes Stats\n- [x] Nodes Info\n- [ ] Nodes Feature Usage\n- [ ] Remote Cluster Info\n- [x] Task Management API\n- [ ] Nodes hot_threads\n- [ ] Cluster Allocation Explain API\n\n### Rollup APIs (XPack)\n- [x] Create Job\n- [x] Delete Job\n- [x] Get Job\n- [x] Start Job\n- [x] Stop Job\n\n### Query DSL\n\n- [x] Match All Query\n- [x] Inner hits\n- Full text queries\n  - [x] Match Query\n  - [x] Match Boolean Prefix Query\n  - [x] Match Phrase Query\n  - [x] Match Phrase Prefix Query\n  - [x] Multi Match Query\n  - [x] Common Terms Query\n  - [x] Query String Query\n  - [x] Simple Query String Query\n  - [x] Combined Fields Query\n  - [x] Intervals Query\n- Term level queries\n  - [x] Term Query\n  - [x] Terms Query\n  - [x] Terms Set Query\n  - [x] Range Query\n  - [x] Exists Query\n  - [x] Prefix Query\n  - [x] Wildcard Query\n  - [x] Regexp Query\n  - [x] Fuzzy Query\n  - [x] Type Query\n  - [x] Ids Query\n- Compound queries\n  - [x] Constant Score Query\n  - [x] Bool Query\n  - [x] Dis Max Query\n  - [x] Function Score Query\n  - [x] Boosting Query\n- Joining queries\n  - [x] Nested Query\n  - [x] Has Child Query\n  - [x] Has Parent Query\n  - [x] Parent Id Query\n- Geo queries\n  - [ ] GeoShape Query\n  - [x] Geo Bounding Box Query\n  - [x] Geo Distance Query\n  - [x] Geo Polygon Query\n- Specialized queries\n  - [x] Distance Feature Query\n  - [x] More Like This Query\n  - [x] Script Query\n  - [x] Script Score Query\n  - [x] Percolate Query\n- Span queries\n  - [x] Span Term Query\n  - [ ] Span Multi Term Query\n  - [x] Span First Query\n  - [x] Span Near Query\n  - [ ] Span Or Query\n  - [ ] Span Not Query\n  - [ ] Span Containing Query\n  - [ ] Span Within Query\n  - [ ] Span Field Masking Query\n- [ ] Minimum Should Match\n- [ ] Multi Term Query Rewrite\n\n### Modules\n\n- Snapshot and Restore\n  - [x] Repositories\n  - [x] Snapshot get\n  - [x] Snapshot create\n  - [x] Snapshot delete\n  - [ ] Restore\n  - [ ] Snapshot status\n  - [ ] Monitoring snapshot/restore status\n  - [ ] Stopping currently running snapshot and restore\n- Scripting\n  - [x] GetScript\n  - [x] PutScript\n  - [x] DeleteScript\n\n### Sorting\n\n- [x] Sort by score\n- [x] Sort by field\n- [x] Sort by geo distance\n- [x] Sort by script\n- [x] Sort by doc\n\n### Scrolling\n\nScrolling is supported via a  `ScrollService`. It supports an iterator-like interface.\nThe `ClearScroll` API is implemented as well.\n\nA pattern for [efficiently scrolling in parallel](https://github.com/olivere/elastic/wiki/ScrollParallel)\nis described in the [Wiki](https://github.com/olivere/elastic/wiki).\n\n## How to contribute\n\nRead [the contribution guidelines](https://github.com/olivere/elastic/blob/master/CONTRIBUTING.md).\n\n## Credits\n\nThanks a lot for the great folks working hard on\n[Elasticsearch](https://www.elastic.co/products/elasticsearch)\nand\n[Go](https://golang.org/).\n\nElastic uses portions of the\n[uritemplates](https://github.com/jtacoma/uritemplates) library\nby Joshua Tacoma,\n[backoff](https://github.com/cenkalti/backoff) by Cenk Altı and\n[leaktest](https://github.com/fortytw2/leaktest) by Ian Chiles.\n\n## LICENSE\n\nMIT-LICENSE. See [LICENSE](http://olivere.mit-license.org/)\nor the LICENSE file provided in the repository for details.\n","funding_links":["https://www.buymeacoffee.com/Bjd96U8fm"],"categories":["Database Drivers","开源类库","Go","數據庫驅動","Open source library","数据库驱动","Data Integration Frameworks","Generators","数据库驱动程序","数据库驱动`连接和操作数据库工具`","Libraries","\u003cspan id=\"数据库驱动-database-drivers\"\u003e数据库驱动 Database Drivers\u003c/span\u003e","NoSQL Databases"],"sub_categories":["Search and Analytic Databases","搜索推荐","Advanced Console UIs","高級控制台界面","Search Recommendations","检索及分析资料库","SQL 查询语句构建库","高级控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivere%2Felastic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folivere%2Felastic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivere%2Felastic/lists"}