Skip to content

Commit

Permalink
Add OpenSearch 2.0 support to .Net client. (#51)
Browse files Browse the repository at this point in the history
* Update nuget packages (#88)
* Cleanup - removing stale dependencies.
* Fix 2 typos in scripts project
* Update `scripts` project file to include all relevant objects.
* Rename `master` node role to `cluster_manager` as it was done in OpenSearch.
    Ref: opensearch-project/OpenSearch#2480
* Remove validation for indices segments stats.
    `OpenSearch` 2.0 uses newer version of `Lucene` (9.0) which doesn't provide segments stats info.
    Ref: opensearch-project/OpenSearch#2029 opensearch-project/OpenSearch#1109
    See also history for `server/src/main/java/org/opensearch/index/engine/SegmentsStats.java` in `OpenSearch` repo.
* Remove tests for `_type` validation in mapping APIs as it was removed from `OpenSearch`.
    Ref: opensearch-project/OpenSearch#2238 opensearch-project/OpenSearch#2480
* Remove usage of deprecated `search.remote` settings.
    Ref: opensearch-project/OpenSearch#1870
* Update abstractions package - patch to support OpenSearch 2.0. Update integration workflow to run tests on OpenSearch 2.0.
* Rename `master_timeout` to `cluster_manager_timeout` in all APIs where it is used.
* Enrich comments to already renamed `CatMaster`/`CatClusterManager` API.
* Rename in `/_cluster/stats`/`cluster.stats` and `/_cluster/state`/`cluster.state`.
* Add deprecation info.
* Rename in comments.
* Rename in test data.
* Renamings in tests including `MasterEligible`, but mark it is obsolete.
* Rename branch reference in scripting.
* Mark `indices.exists_type`/`TypeExists` APIs as deprecated.
* Update compatibility matrix and include it into `sln` file.
* Add deprecation notice to all reference of `include_type_name`/`IncludeTypeName`.
* Update compatibility matrix.
* Remove `OpenDistro` compatibility notice.
* Update repo link.
* Add small README for each project being released.
* Address PR #51 feedback.

Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>

Signed-off-by: Yury-Fridlyand <yuryf@bitquilltech.com>
  • Loading branch information
Yury-Fridlyand committed Aug 31, 2022
1 parent 6a3687b commit 835c266
Show file tree
Hide file tree
Showing 163 changed files with 2,716 additions and 494 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
# 1.0.1 is skipped because it doesn't have a tag in OpenSearch repo, we can't check out to compile plugins
version: [1.3.1, 1.3.0, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.0]
version: [2.2.0, 2.1.0, 2.0.0, 1.3.1, 1.3.0, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.0]

steps:
# Due to https://github.com/opensearch-project/project-website/issues/737
Expand Down
21 changes: 9 additions & 12 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
- [Compatibility with OpenSearch](#compatibility-with-opensearch)
- [Upgrading](#upgrading)

## Compatibility with OpenSearch

The below matrix shows the compatibility of the `opensearch-net` with versions of [`OpenSearch`](https://opensearch.org/downloads.html#opensearch). Currently this client is in a pre-release phase. The below matrix shows compatibility for the upcoming version.
The below matrix shows the compatibility of the [`opensearch-net`](https://www.nuget.org/profiles/opensearchproject) with versions of [`OpenSearch`](https://opensearch.org/downloads.html#opensearch).

| OpenSearch Version | Client Version |
| --- | --- |
| 1.0.0 | 1.0.0 |
| 1.0.1 | 1.0.0 |
| 1.1.0 | 1.0.0 |
| 1.2.0 | 1.0.0 |
| 1.2.1 | 1.0.0 |
| 1.2.2 | 1.0.0 |
| 1.2.3 | 1.0.0 |
| 1.2.4 | 1.0.0 |
| 1.3.0 | 1.0.0 |
| 1.3.1 | 1.0.0 |
|--------------------|----------------|
| 1.x | 1.0.0, 1.1.0 |
| 2.x | 1.1.0 |

## Upgrading

Major versions of OpenSearch introduce breaking changes that require careful upgrades of the client. While `opensearch-net` client 1.1.0 works against the latest OpenSearch 1.x, certain deprecated features removed in OpenSearch 2.0 have also been removed from the client. Please refer to the [OpenSearch documentation](https://opensearch.org/docs/latest/clients/index/) for more information.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReleaseNotes>See https://github.com/opensearch-project/opensearch-net/releases</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/opensearch-project/opensearch-net</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/opensearch-project/opensearch-net/master/build/nuget-icon.png</PackageIconUrl>
<PackageIconUrl>https://raw.githubusercontent.com/opensearch-project/opensearch-net/main/build/nuget-icon.png</PackageIconUrl>
</PropertyGroup>

<PropertyGroup>
Expand Down
7 changes: 7 additions & 0 deletions OpenSearch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{2FABB663-F4DB-499A-89F8-3A08828D1D91}"
ProjectSection(SolutionItems) = preProject
admins.md = admins.md
code_of_conduct.md = code_of_conduct.md
compatibility.md = compatibility.md
contributing.md = contributing.md
maintainers.md = maintainers.md
license.txt = license.txt
readme.md = readme.md
releasing.md = releasing.md
security.md = security.md
user_guide.md = user_guide.md
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Tests.YamlRunner", "tests\Tests.YamlRunner\Tests.YamlRunner.fsproj", "{81473437-5722-4829-A5CD-125B17CCA238}"
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/Versioning.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ module Versioning =
let globalJson = globalJson ()
let doc_current =
match globalJson.doc_current with
| "master" -> "master"
| "main" -> "main"
| _ -> sprintf "%i.%i" version.Major version.Minor
let doc_branch =
match globalJson.doc_current with
| "master" -> "master"
| "main" -> "main"
| _ -> sprintf "%i.x" version.Major

let newGlobalJson = {
Expand Down
2 changes: 1 addition & 1 deletion src/ApiGenerator/Domain/Code/CsharpNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public string PerPathMethodName(string path)

var method = MethodName;
// This is temporary for transition period
// TODO: remove in master once master in opensearch is scrubbed
// TODO: remove in branch once it in opensearch is scrubbed
if (path.Contains("{type}") && !method.Contains("Type")) method += "UsingType";

if (ms("Indices") && !pc("{index}"))
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.allocation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
73 changes: 73 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.cluster_manager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cat.cluster_manager":{
"documentation":{
"url":"https://opensearch.org/docs/2.0/opensearch/rest-api/cat/cat-cluster_manager/",
"description":"Returns information about the cluster_manager node. Introduced in OpenSearch 2.0 instead of cat-master."
},
"stability":"stable",
"visibility":"public",
"headers":{
"accept": [ "text/plain", "application/json"]
},
"url":{
"paths":[
{
"path":"/_cat/cluster_manager",
"methods":[
"GET"
]
},
{
"path":"/_cat/master",
"methods":[
"GET"
],
"deprecated":{
"version":"2.0.0",
"description":"To promote inclusive language, please use '/_cat/cluster_manager' instead."
}
}
]
},
"params":{
"format":{
"type":"string",
"description":"a short version of the Accept header, e.g. json, yaml"
},
"local":{
"type":"boolean",
"description":"Return local information, do not retrieve the state from cluster-manager node (default: false)"
},
"master_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to master node",
"deprecated":{
"version":"2.0.0",
"description":"To promote inclusive language, use 'cluster_manager_timeout' instead."
}
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
},
"help":{
"type":"boolean",
"description":"Return help information",
"default":false
},
"s":{
"type":"list",
"description":"Comma-separated list of column names or column aliases to sort by"
},
"v":{
"type":"boolean",
"description":"Verbose mode. Display column headers",
"default":false
}
}
}
}
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.indices.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 2 additions & 2 deletions src/ApiGenerator/RestSpecification/Core/cat.master.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"cat.master":{
"documentation":{
"url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-master/",
"description":"Returns information about the master node."
"url":"https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/",
"description":"Returns information about the master node. Deprecated as of OpenSearch 2.0, use cat-cluster_manager instead."
},
"stability":"stable",
"visibility":"public",
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.nodeattrs.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.repositories.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.shards.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.snapshots.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cat.thread_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"h":{
"type":"list",
"description":"Comma-separated list of column names to display"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
},
"master_timeout":{
"type":"time",
"description":"Specify timeout for connection to master"
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"local":{
"type":"boolean",
"description":"Return local information, do not retrieve the state from master node (default: false)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"local":{
"type":"boolean",
"description":"Return local information, do not retrieve the state from master node (default: false)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"timeout":{
"type":"time",
"description":"Explicit operation timeout"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cluster.health.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"timeout":{
"type":"time",
"description":"Explicit operation timeout"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
},
"master_timeout":{
"type":"time",
"description":"Specify timeout for connection to master"
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
},
"master_timeout":{
"type":"time",
"description":"Specify timeout for connection to master"
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
}
},
"body":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"timeout":{
"type":"time",
"description":"Explicit operation timeout"
Expand Down
4 changes: 4 additions & 0 deletions src/ApiGenerator/RestSpecification/Core/cluster.reroute.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"type":"time",
"description":"Explicit operation timeout for connection to master node"
},
"cluster_manager_timeout":{
"type":"time",
"description":"Explicit operation timeout for connection to cluster_manager_timeout node"
},
"timeout":{
"type":"time",
"description":"Explicit operation timeout"
Expand Down
Loading

0 comments on commit 835c266

Please sign in to comment.