Skip to content

Commit c2f3f5b

Browse files
committed
run prettier to reformat markdown
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 3131596 commit c2f3f5b

9 files changed

Lines changed: 71 additions & 35 deletions

File tree

CHANGELOG.md

Lines changed: 30 additions & 5 deletions
Large diffs are not rendered by default.

DEVELOPER_GUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ OpenSearch Go Client builds using [Go](https://go.dev/doc/install) 1.24 at a min
4242
To build the project on Windows, use [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install), the compatibility layer for running Linux applications.
4343

4444
Install `make`
45+
4546
```
4647
sudo apt install make
4748
```
@@ -67,15 +68,15 @@ In order to test opensearch-go client, you need a running OpenSearch cluster. Yo
6768

6869
### Composing an OpenSearch Docker Container
6970

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.
7172

7273
```
7374
make cluster.build cluster.start
7475
```
7576

7677
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.
7778

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.
7980

8081
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'.
8182

@@ -143,5 +144,4 @@ After you have opened your project, you need to specify the location of the Go S
143144

144145
### Vim
145146

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.

RELEASING.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,23 @@ The release process is standard across repositories in this org and is run by a
4141
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).
4242
7. Draft and publish a [new GitHub release](https://github.com/opensearch-project/opensearch-go/releases/new) from the newly created tag.
4343
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]
4644

47-
### Added
45+
```
46+
## [Unreleased]
4847
49-
### Changed
48+
### Added
5049
51-
### Deprecated
50+
### Changed
5251
53-
### Removed
52+
### Deprecated
5453
55-
### Fixed
54+
### Removed
5655
57-
### Security
56+
### Fixed
57+
58+
### Security
59+
60+
### Dependencies
61+
```
5862

59-
### Dependencies
60-
```
6163
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`.

UPGRADING.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,31 @@
1212
# Upgrading Opensearch GO Client
1313

1414
## Upgrading to >= 5.0.0
15+
1516
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.
1617

1718
Before 5.0.0:
19+
1820
```go
1921
docDelResp, err = client.Document.Delete(ctx, opensearchapi.DocumentDeleteReq{Index: "movies", DocumentID: "3"})
2022
if err != nil {
2123
fmt.Println(err)
22-
24+
2325
if !errors.Is(err, opensearch.ErrJSONUnmarshalBody) && docDelResp != nil {
2426
resp := docDelResp.Inspect().Response
2527
// get http status
2628
fmt.Println(resp.StatusCode)
2729
body := strings.TrimPrefix(err.Error(), "opensearch error response could not be parsed as error: ")
2830
errResp := opensearchapi.DocumentDeleteResp{}
29-
json.Unmarshal([]byte(body), &errResp)
30-
// extract result field from the body
31+
json.Unmarshal([]byte(body), &errResp)
32+
// extract result field from the body
3133
fmt.Println(errResp.Result)
3234
}
3335
}
3436
```
3537

3638
After 5.0.0:
39+
3740
```go
3841
docDelResp, err = client.Document.Delete(ctx, opensearchapi.DocumentDeleteReq{Index: "movies", DocumentID: "3"})
3942
if err != nil {
@@ -50,20 +53,19 @@ if err != nil {
5053
}
5154
```
5255

53-
5456
## Upgrading to >= 4.0.0
5557

5658
Version 4.0.0 moved the error types, added with 3.0.0, from opensearchapi to opensearch, renamed them and added new error types.
5759

5860
### Error Types
5961

60-
Before 4.0.0:
61-
Error types:
62+
Before 4.0.0: Error types:
63+
6264
- `opensearchapi.Error`
6365
- `opensearchapi.StringError`
6466

65-
With 4.0.0:
66-
Error types
67+
With 4.0.0: Error types
68+
6769
- `opensearch.Error`
6870
- `opensearch.StringError`
6971
- `opensearch.ReasonError`
@@ -75,9 +77,11 @@ Error types
7577
Version 3.0.0 is a major refactor of the client.
7678

7779
### Client Creation
80+
7881
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.
7982

8083
Before 3.0.0:
84+
8185
```go
8286
// default client
8387
client, err := opensearch.NewDefaultClient()
@@ -150,7 +154,6 @@ createIndexResponse, err := client.Indices.Create(
150154
)
151155
```
152156

153-
154157
### Responses
155158

156159
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().

USER_GUIDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
- [User Guide](#user-guide)
2-
- [Example](#example)
3-
- [Amazon OpenSearch Service](#amazon-opensearch-service)
4-
- [AWS SDK v1](#aws-sdk-v1)
5-
- [AWS SDK v2](#aws-sdk-v2)
6-
- [Guides by Topic](#guides-by-topic)
2+
- [Example](#example)
3+
- [Amazon OpenSearch Service](#amazon-opensearch-service)
4+
- [AWS SDK v1](#aws-sdk-v1)
5+
- [AWS SDK v2](#aws-sdk-v2)
6+
- [Guides by Topic](#guides-by-topic)
77

88
# User Guide
99

@@ -268,7 +268,7 @@ func example() error {
268268
}
269269

270270
ctx := context.Background()
271-
271+
272272
ping, err := client.Ping(ctx, nil)
273273
if err != nil {
274274
return err

guides/bulk.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ You can choose different routing strategies based on your cluster setup:
323323
```
324324
325325
The smart selector automatically detects different operation types:
326+
326327
- **Bulk operations** (`/_bulk`) -> Routes to ingest nodes
327328
- **Ingest pipeline operations** (`/_ingest/`) -> Routes to ingest nodes
328329
- **Search operations** (`/_search`) -> Routes to data nodes

guides/node_discovery_and_roles.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ client, err := opensearch.NewClient(opensearch.Config{
7575
```
7676

7777
When `IncludeDedicatedClusterManagers` is disabled (default), these nodes will be EXCLUDED from request routing:
78+
7879
- Nodes with only "cluster_manager" role
7980
- Nodes with only "master" role (deprecated)
8081
- Nodes with "cluster_manager" + "remote_cluster_client" roles only
8182

8283
These nodes will be INCLUDED (even with IncludeDedicatedClusterManagers disabled):
84+
8385
- Cluster manager + data nodes
8486
- Cluster manager + ingest nodes
8587
- Cluster manager + warm nodes (OpenSearch 3.0+ for searchable snapshots)
@@ -293,4 +295,4 @@ func main() {
293295
// 4. Refresh node list periodically
294296
// 5. Log deprecation warnings for old role names
295297
}
296-
```
298+
```

guides/request_routing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ client, err := opensearch.NewClient(opensearch.Config{
2323
### Enable Smart Routing
2424

2525
```go
26+
import "github.com/opensearch-project/opensearch-go/v4/opensearchtransport"
27+
2628
// Recommended: intelligent request routing
2729
client, err := opensearch.NewClient(opensearch.Config{
2830
Addresses: []string{"http://localhost:9200"},

guides/search.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ The smart selector automatically detects operation types and routes them to the
353353
### Routing Strategy Overview
354354
355355
The smart selector provides automatic routing based on the operation being performed:
356+
356357
- **Search operations** (`/_search`, `/_msearch`, document retrieval) -> Data nodes
357358
- **Bulk operations** (`/_bulk`) -> Ingest nodes
358359
- **Ingest operations** (`/_ingest/`) -> Ingest nodes

0 commit comments

Comments
 (0)