You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPER_GUIDE.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,7 @@ OpenSearch Go Client builds using [Go](https://go.dev/doc/install) 1.24 at a min
42
42
To build the project on Windows, use [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install), the compatibility layer for running Linux applications.
43
43
44
44
Install `make`
45
+
45
46
```
46
47
sudo apt install make
47
48
```
@@ -67,15 +68,15 @@ In order to test opensearch-go client, you need a running OpenSearch cluster. Yo
67
68
68
69
### Composing an OpenSearch Docker Container
69
70
70
-
Ensure that Docker is installed on your local machine. You can check by running `docker --version`. Next, navigate to your local opensearch-go repository. Run the following command to build and start the OpenSearch docker container.
71
+
Ensure that Docker is installed on your local machine. You can check by running `docker --version`. Next, navigate to your local opensearch-go repository. Run the following command to build and start the OpenSearch docker container.
71
72
72
73
```
73
74
make cluster.build cluster.start
74
75
```
75
76
76
77
This command will start the OpenSearch container using the `docker-compose.yaml` configuration file. During the build process, the necessary dependencies and files will be downloaded, which may take some time depending on your internet connection and system resources.
77
78
78
-
Once the container is built and running, you can open a web browser and navigate to localhost:9200 to access the OpenSearch docker container.
79
+
Once the container is built and running, you can open a web browser and navigate to localhost:9200 to access the OpenSearch docker container.
79
80
80
81
In order to differentiate unit tests from integration tests, Go has a built-in mechanism for allowing you to logically separate your tests with [build tags](https://pkg.go.dev/cmd/go#hdr-Build_constraints). The build tag needs to be placed as close to the top of the file as possible, and must have a blank line beneath it. Hence, create all integration tests with build tag 'integration'.
81
82
@@ -143,5 +144,4 @@ After you have opened your project, you need to specify the location of the Go S
143
144
144
145
### Vim
145
146
146
-
To improve your vim experience with Go, you might want to check out [fatih/vim-go](https://github.com/fatih/vim-go).
147
-
For example it correctly formats the file and validates it on save.
147
+
To improve your vim experience with Go, you might want to check out [fatih/vim-go](https://github.com/fatih/vim-go). For example it correctly formats the file and validates it on save.
Copy file name to clipboardExpand all lines: RELEASING.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,21 +41,23 @@ The release process is standard across repositories in this org and is run by a
41
41
6. Create a tag, e.g. `v4.3.0`, and push it to the GitHub repo. This [makes the new version available](https://go.dev/doc/modules/publishing) on [pkg.go.dev](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4).
42
42
7. Draft and publish a [new GitHub release](https://github.com/opensearch-project/opensearch-go/releases/new) from the newly created tag.
43
43
8. Create a new `Unreleased` section in the [CHANGELOG](CHANGELOG.md), increment version in [version.go](internal/version/version.go) to the next developer iteration (e.g. `4.3.1`), and make a pull request with this change into `main`, e.g. [opensearch-go#448](https://github.com/opensearch-project/opensearch-go/pull/448).
44
-
```
45
-
## [Unreleased]
46
44
47
-
### Added
45
+
```
46
+
## [Unreleased]
48
47
49
-
### Changed
48
+
### Added
50
49
51
-
### Deprecated
50
+
### Changed
52
51
53
-
### Removed
52
+
### Deprecated
54
53
55
-
### Fixed
54
+
### Removed
56
55
57
-
### Security
56
+
### Fixed
57
+
58
+
### Security
59
+
60
+
### Dependencies
61
+
```
58
62
59
-
### Dependencies
60
-
```
61
63
9. Run `go list` with the new version to refresh [pkg.go.dev](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4), e.g. `go list -m github.com/opensearch-project/opensearch-go/v4@v4.3.0`.
Copy file name to clipboardExpand all lines: UPGRADING.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,28 +12,31 @@
12
12
# Upgrading Opensearch GO Client
13
13
14
14
## Upgrading to >= 5.0.0
15
+
15
16
Version 5.0.0 returns `*opensearch.StringError` error type instead of `*fmt.wrapError` when response received from the server is an unknown JSON. For example, consider delete document API which returns an unknown JSON body when document is not found.
Version 4.0.0 moved the error types, added with 3.0.0, from opensearchapi to opensearch, renamed them and added new error types.
57
59
58
60
### Error Types
59
61
60
-
Before 4.0.0:
61
-
Error types:
62
+
Before 4.0.0: Error types:
63
+
62
64
-`opensearchapi.Error`
63
65
-`opensearchapi.StringError`
64
66
65
-
With 4.0.0:
66
-
Error types
67
+
With 4.0.0: Error types
68
+
67
69
-`opensearch.Error`
68
70
-`opensearch.StringError`
69
71
-`opensearch.ReasonError`
@@ -75,9 +77,11 @@ Error types
75
77
Version 3.0.0 is a major refactor of the client.
76
78
77
79
### Client Creation
80
+
78
81
You now create the client from the opensearchapi and not from the opensearch lib. This was done to make the different APIs independent from each other. Plugin APIs like Security will get there own folder and therefore its own sub-lib.
With the version 3.0.0 the lib no longer returns the opensearch.Response which is just a wrap up http.Response. Instead it will check the response for errors and try to parse the body into existing structs. Please note that some responses are so complex that we parse them as [json.RawMessage](https://pkg.go.dev/encoding/json#RawMessage) so you can parse them to your expected struct. If you need the opensearch.Response, then you can call .Inspect().
**Q: My bulk operations seem slow despite using SmartSelector**
396
+
375
397
- **A**: Check that your cluster has nodes with `ingest` role. If not, operations will fall back to data nodes, which is still correct behavior.
376
398
377
399
**Q: I get "no connections found" errors**
400
+
378
401
- **A**: This indicates a different issue (network, authentication, discovery, lack of healthy hosts). Request routing uses existing connections and does not cause connection failures.
379
402
380
403
**Q: How do I verify routing is working?**
404
+
381
405
- **A**: Use debug logging and monitor which nodes receive requests. In mixed clusters, you should see operations favoring appropriate node types based on your selector chain.
382
406
383
407
**Q: Can I disable request routing?**
408
+
384
409
- **A**: Yes, simply don't provide a Selector or use `opensearchtransport.NewRoundRobinSelector()` directly.
0 commit comments