Skip to content

Commit 8f095c2

Browse files
authored
Add support for Opensearch 3.0 (#709)
* Test against Opensearch 3.0 Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add new fields for opensearch 3.0 Signed-off-by: Jakob Hahn <[email protected]> * Update COMPATIBILITY.md Signed-off-by: Jakob Hahn <[email protected]> --------- Signed-off-by: Jakob Hahn <[email protected]>
1 parent 3532a08 commit 8f095c2

12 files changed

+46
-33
lines changed

.ci/opensearch/Dockerfile.opensearch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN if [ "$SECURE_INTEGRATION" != "true" ] ; then \
1616
echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" | tee -a $opensearch_path/config/opensearch.yml > /dev/null; \
1717
echo "plugins.security.ssl_cert_reload_enabled: true" | tee -a $opensearch_path/config/opensearch.yml > /dev/null; \
1818
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }; \
19-
if [ $(version $OPENSEARCH_VERSION) -ge $(version "2.8.0") ] || [ $OPENSEARCH_VERSION == "latest" ]; then \
19+
if [ $(version $OPENSEARCH_VERSION) -ge $(version "2.8.0") ] || [ "$OPENSEARCH_VERSION" == "latest" ]; then \
2020
echo "plugins.security.restapi.admin.enabled: true" | tee -a $opensearch_path/config/opensearch.yml > /dev/null; \
2121
fi \
2222
fi

.ci/opensearch/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
opensearch:
53
deploy:

.github/workflows/test-compatibility.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ jobs:
2828
- { opensearch_version: 2.14.0 }
2929
- { opensearch_version: 2.15.0 }
3030
- { opensearch_version: 2.16.0 }
31-
- { opensearch_version: 2.17.0 }
31+
- { opensearch_version: 2.17.1 }
3232
- { opensearch_version: 2.18.0 }
33-
- { opensearch_version: 2.19.0 }
33+
- { opensearch_version: 2.19.2 }
34+
- { opensearch_version: 3.0.0 }
3435
steps:
3536
- uses: actions/checkout@v4
3637

.github/workflows/test-integration-unreleased.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
entry:
12-
- { branch: '1.x', java-version: '11' }
1312
- { branch: '2.x', java-version: '17' }
13+
# - { branch: '3.x', java-version: '21' }
1414
- { branch: 'main', java-version: '21' }
1515
steps:
1616
- name: Checkout OpenSearch

.github/workflows/test-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
env:
66
GITHUB_ACTIONS: true
7-
OPENSEARCH_VERSION: 2.19.0
7+
OPENSEARCH_VERSION: 2.19.2
88

99
jobs:
1010
test:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
77
### Dependencies
88

99
### Added
10+
- Adds new fields for Opensearch 3.0 ([#702](https://github.com/opensearch-project/opensearch-go/pull/702))
1011

1112
### Changed
13+
- Test against Opensearch 3.0 ([#702](https://github.com/opensearch-project/opensearch-go/pull/702))
1214

1315
### Deprecated
1416

COMPATIBILITY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The below matrix shows the compatibility of the [`opensearch-go`](https://pkg.go
99
| -------------- | ------------------ |
1010
| 1.x.0 | 1.x |
1111
| 2.x.0 | 1.3.13-2.11.0 |
12+
| 3.x.0 | 1.3.13-2.12.0 |
13+
| 4.x.0 | 1.3.20-3.0.0 |
1214

1315
## Upgrading
1416

opensearchapi/api_cluster-state.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ type ClusterStateMetaDataStream struct {
194194
type ClusterStateRoutingIndex struct {
195195
State string `json:"state"`
196196
Primary bool `json:"primary"`
197+
SearchOnly bool `json:"searchOnly"`
197198
Node *string `json:"node"`
198199
RelocatingNode *string `json:"relocating_node"`
199200
Shard int `json:"shard"`

opensearchapi/api_cluster-stats.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ type ClusterStatsNodes struct {
194194
Master int `json:"master"`
195195
RemoteClusterClient int `json:"remote_cluster_client"`
196196
Search int `json:"search"`
197+
Warm int `json:"warm"`
197198
} `json:"count"`
198199
Versions []string `json:"versions"`
199200
Os struct {

opensearchapi/api_nodes-info.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,29 @@ func (r NodesInfoResp) Inspect() Inspect {
7171

7272
// NodesInfo is a sub type of NodesInfoResp containing information about nodes and their stats
7373
type NodesInfo struct {
74-
Name string `json:"name"`
75-
TransportAddress string `json:"transport_address"`
76-
Host string `json:"host"`
77-
IP string `json:"ip"`
78-
Version string `json:"version"`
79-
BuildType string `json:"build_type"`
80-
BuildHash string `json:"build_hash"`
81-
TotalIndexingBuffer int64 `json:"total_indexing_buffer"`
82-
Roles []string `json:"roles"`
83-
Attributes map[string]string `json:"attributes"`
84-
Settings json.RawMessage `json:"settings"` // Won't parse as it may contain fields that we can't know
85-
OS NodesInfoOS `json:"os"`
86-
Process NodesInfoProcess `json:"process"`
87-
JVM NodesInfoJVM `json:"jvm"`
88-
ThreadPool map[string]NodesInfoThreadPool `json:"thread_pool"`
89-
Transport NodesInfoTransport `json:"transport"`
90-
HTTP NodesInfoHTTP `json:"http"`
91-
Plugins []NodesInfoPlugin `json:"plugins"`
92-
Modules []NodesInfoPlugin `json:"modules"`
93-
Ingest NodesInfoIngest `json:"ingest"`
94-
Aggregations map[string]NodesInfoAgg `json:"aggregations"`
95-
SearchPipelines NodesInfoSearchPipelines `json:"search_pipelines"`
74+
Name string `json:"name"`
75+
TransportAddress string `json:"transport_address"`
76+
Host string `json:"host"`
77+
IP string `json:"ip"`
78+
Version string `json:"version"`
79+
BuildType string `json:"build_type"`
80+
BuildHash string `json:"build_hash"`
81+
TotalIndexingBuffer int64 `json:"total_indexing_buffer"`
82+
TotalIndexingBufferInBytes int64 `json:"total_indexing_buffer_in_bytes"`
83+
Roles []string `json:"roles"`
84+
Attributes map[string]string `json:"attributes"`
85+
Settings json.RawMessage `json:"settings"` // Won't parse as it may contain fields that we can't know
86+
OS NodesInfoOS `json:"os"`
87+
Process NodesInfoProcess `json:"process"`
88+
JVM NodesInfoJVM `json:"jvm"`
89+
ThreadPool map[string]NodesInfoThreadPool `json:"thread_pool"`
90+
Transport NodesInfoTransport `json:"transport"`
91+
HTTP NodesInfoHTTP `json:"http"`
92+
Plugins []NodesInfoPlugin `json:"plugins"`
93+
Modules []NodesInfoPlugin `json:"modules"`
94+
Ingest NodesInfoIngest `json:"ingest"`
95+
Aggregations map[string]NodesInfoAgg `json:"aggregations"`
96+
SearchPipelines NodesInfoSearchPipelines `json:"search_pipelines"`
9697
}
9798

9899
// NodesInfoOS is a sub type of NodesInfo containing information about the Operating System

opensearchapi/api_nodes-stats.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ type NodesStatsSearchBackpressure struct {
624624
CancellationCount int `json:"cancellation_count"`
625625
CancellationLimitReachedCount int `json:"cancellation_limit_reached_count"`
626626
} `json:"cancellation_stats"`
627+
CompletionCount int `json:"completion_count"`
627628
} `json:"search_task"`
628629
SearchShardTask struct {
629630
ResourceTrackerStats struct {
@@ -640,6 +641,7 @@ type NodesStatsSearchBackpressure struct {
640641
CancellationCount int `json:"cancellation_count"`
641642
CancellationLimitReachedCount int `json:"cancellation_limit_reached_count"`
642643
} `json:"cancellation_stats"`
644+
CompletionCount int `json:"completion_count"`
643645
} `json:"search_shard_task"`
644646
Mode string `json:"mode"`
645647
}
@@ -678,10 +680,14 @@ type NodesStatsSearchPipeline struct {
678680

679681
// NodesStatsTaskCancellation is a sub type of NodesStats containing stats about canceled tasks
680682
type NodesStatsTaskCancellation struct {
681-
SearchShardTask struct {
682-
CurrentCountPostCancel int `json:"current_count_post_cancel"`
683-
TotalCountPostCancel int `json:"total_count_post_cancel"`
684-
} `json:"search_shard_task"`
683+
SearchTask NodesStatsTaskCancellationValues `json:"search_task"`
684+
SearchShardTask NodesStatsTaskCancellationValues `json:"search_shard_task"`
685+
}
686+
687+
// NodesStatsTaskCancellationValues is a sub type of NodesStatsTaskCancellation
688+
type NodesStatsTaskCancellationValues struct {
689+
CurrentCountPostCancel int `json:"current_count_post_cancel"`
690+
TotalCountPostCancel int `json:"total_count_post_cancel"`
685691
}
686692

687693
// NodesStatsIndicesSearchRequest is a sub type of NodesStatsIndices containing stats about search requests

opensearchapi/api_search_shards.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ type SearchShardsResp struct {
7272
Shards [][]struct {
7373
State string `json:"state"`
7474
Primary bool `json:"primary"`
75+
SearchOnly bool `json:"searchOnly"`
7576
Node string `json:"node"`
7677
RelocatingNode *string `json:"relocating_node"`
7778
Shard int `json:"shard"`

0 commit comments

Comments
 (0)