Skip to content

Commit

Permalink
Merge branch 'main' into generate-get-snapshot
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Nov 25, 2024
2 parents d6c4d3b + ca3d488 commit d6604c6
Show file tree
Hide file tree
Showing 318 changed files with 15,618 additions and 2,582 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-13, macOS-latest]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog_verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
verify-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
installation_id: 22958780

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ steps.github_app_token.outputs.token }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: lychee Link Checker
id: lychee
uses: lycheeverse/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
aws-region: us-east-1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- id: get_data
run: |
echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT
Expand All @@ -34,7 +34,7 @@ jobs:
run: |
./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository && tar -C build -cvf artifacts.tar.gz repository
- name: Draft a release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integration-unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
distribution: 'temurin'

- name: Checkout OpenSearch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
for attempt in {1..20}; do sleep 5; if curl -s localhost:9200; then echo '=====> ready'; break; fi; echo '=====> waiting...'; done
- name: Checkout Java Client
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: opensearch-java

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- { opensearch_version: 2.13.0, java: 11 }
steps:
- name: Checkout Java Client
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
Expand All @@ -38,7 +38,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-13]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK 8 (Runtime)
uses: actions/setup-java@v3
Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This section is for maintaining a changelog for all breaking changes for the cli

### Added
- Document HTTP/2 support ([#330](https://github.com/opensearch-project/opensearch-java/pull/330))
- Added `toBuilder()` and `Builder.copy()` methods to all generated classes ([#1300](https://github.com/opensearch-project/opensearch-java/pull/1300))

### Dependencies

Expand Down Expand Up @@ -44,17 +45,29 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Dependencies

### Changed
- Changed AwsSdk2Transport to pre-emptively throw an exception when using AWS SDK's ApacheHttpClient to make an unsupported DELETE/GET request with a body ([#1256](https://github.com/opensearch-project/opensearch-java/pull/1256))

### Deprecated

### Removed

### Fixed
- Fixed an issue where `FieldSort` was not implementing `SortOptionsVariant` ([#1323](https://github.com/opensearch-project/opensearch-java/pull/1323))
- Fixed don't invoke the mapper's serialize method for the RangeQuery JsonData raw value ([#1309](https://github.com/opensearch-project/opensearch-java/pull/1309))
- Fixed `GetSnapshotResponse` deserialization ([#1299](https://github.com/opensearch-project/opensearch-java/pull/1299))

### Security

## [2.18.0] - 11/19/2024
### Added
- Added support for disabling typed keys serialization ([#1296](https://github.com/opensearch-project/opensearch-java/pull/1296))
- Added support for the `batch_size` param on the `text_embedding` processor ([#1298](https://github.com/opensearch-project/opensearch-java/pull/1298))

### Dependencies
- Bump `io.github.classgraph:classgraph` from 4.8.177 to 4.8.179 ([#1302](https://github.com/opensearch-project/opensearch-java/pull/1302))

### Changed
- Changed AwsSdk2Transport to pre-emptively throw an exception when using AWS SDK's ApacheHttpClient to make an unsupported DELETE/GET request with a body ([#1256](https://github.com/opensearch-project/opensearch-java/pull/1256))

## [2.17.0] - 11/05/2024
### Added
- Added support for `KnnVectorProperty`'s `compression_level`, `data_type`, `mode` & `space_type` properties ([#1255](https://github.com/opensearch-project/opensearch-java/pull/1255))
Expand Down Expand Up @@ -568,7 +581,8 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Security

[Unreleased 3.0]: https://github.com/opensearch-project/opensearch-java/compare/2.x...HEAD
[Unreleased 2.x]: https://github.com/opensearch-project/opensearch-java/compare/v2.17.0...2.x
[Unreleased 2.x]: https://github.com/opensearch-project/opensearch-java/compare/v2.18.0...2.x
[2.18.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.17.0...v2.18.0
[2.17.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.16.0...v2.17.0
[2.16.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.15.0...v2.16.0
[2.15.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.14.0...v2.15.0
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6
16 changes: 16 additions & 0 deletions guides/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ private String toJson(JsonpSerializable object) {
}
```

### Disabling Typed Keys Serialization
By default, the JSON serialization of the OpenSearch Java client uses typed keys for certain types, notably Aggregations.
This is done for the benefit of unambiguous deserialization, but may result in JSON output that is incompatible with use-cases expecting OpenSearch's default untyped keys.
You may disable this behavior by setting the `JsonpMapperAttributes.SERIALIZE_TYPED_KEYS` attribute to `false` on a JsonpMapper instance.
For example, the following code demonstrates how to serialize a SearchResponse without typed keys:
```java
private String withoutTypedKeys(OpenSearchClient client, SearchResponse response) {
JsonpMapper mapper = client._transport().jsonpMapper().withAttribute(JsonpMapperAttributes.SERIALIZE_TYPED_KEYS, false);
StringWriter writer = new StringWriter();
try (JsonGenerator generator = mapper.jsonProvider().createGenerator(writer)) {
response.serialize(generator, mapper);
}
return writer.toString();
}
```

## Deserialization

For demonstration let's consider an IndexTemplateMapping JSON String.
Expand Down
2 changes: 1 addition & 1 deletion java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ dependencies {
implementation("org.eclipse", "yasson", "2.0.2")

// https://github.com/classgraph/classgraph
testImplementation("io.github.classgraph:classgraph:4.8.177")
testImplementation("io.github.classgraph:classgraph:4.8.179")

// Eclipse 1.0
testImplementation("junit", "junit" , "4.13.2") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

import jakarta.json.stream.JsonGenerator;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectDeserializer;
Expand Down Expand Up @@ -88,18 +89,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>> extends ObjectBuilderBase {
private Boolean acknowledged;

protected AbstractBuilder() {}

protected AbstractBuilder(AcknowledgedResponseBase o) {
this.acknowledged = o.acknowledged;
}

protected AbstractBuilder(AbstractBuilder<BuilderT> o) {
this.acknowledged = o.acknowledged;
}

@Nonnull
protected abstract BuilderT self();

/**
* Required - For a successful response, this value is always true. On failure, an exception is returned instead.
* <p>
* API name: {@code acknowledged}
* </p>
*/
@Nonnull
public final BuilderT acknowledged(boolean value) {
this.acknowledged = value;
return self();
}

protected abstract BuilderT self();
}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,37 @@ protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder
@Nullable
private String transportAddress;

protected AbstractBuilder() {}

protected AbstractBuilder(BaseNode o) {
this.attributes = _mapCopy(o.attributes);
this.host = o.host;
this.ip = o.ip;
this.name = o.name;
this.roles = _listCopy(o.roles);
this.transportAddress = o.transportAddress;
}

protected AbstractBuilder(AbstractBuilder<BuilderT> o) {
this.attributes = _mapCopy(o.attributes);
this.host = o.host;
this.ip = o.ip;
this.name = o.name;
this.roles = _listCopy(o.roles);
this.transportAddress = o.transportAddress;
}

@Nonnull
protected abstract BuilderT self();

/**
* API name: {@code attributes}
*
* <p>
* Adds all elements of <code>map</code> to <code>attributes</code>.
* </p>
*/
@Nonnull
public final BuilderT attributes(Map<String, String> map) {
this.attributes = _mapPutAll(this.attributes, map);
return self();
Expand All @@ -215,6 +239,7 @@ public final BuilderT attributes(Map<String, String> map) {
* Adds an entry to <code>attributes</code>.
* </p>
*/
@Nonnull
public final BuilderT attributes(String key, String value) {
this.attributes = _mapPut(this.attributes, key, value);
return self();
Expand All @@ -223,6 +248,7 @@ public final BuilderT attributes(String key, String value) {
/**
* API name: {@code host}
*/
@Nonnull
public final BuilderT host(@Nullable String value) {
this.host = value;
return self();
Expand All @@ -231,6 +257,7 @@ public final BuilderT host(@Nullable String value) {
/**
* API name: {@code ip}
*/
@Nonnull
public final BuilderT ip(@Nullable String value) {
this.ip = value;
return self();
Expand All @@ -239,6 +266,7 @@ public final BuilderT ip(@Nullable String value) {
/**
* Required - API name: {@code name}
*/
@Nonnull
public final BuilderT name(String value) {
this.name = value;
return self();
Expand All @@ -251,6 +279,7 @@ public final BuilderT name(String value) {
* Adds all elements of <code>list</code> to <code>roles</code>.
* </p>
*/
@Nonnull
public final BuilderT roles(List<NodeRole> list) {
this.roles = _listAddAll(this.roles, list);
return self();
Expand All @@ -263,6 +292,7 @@ public final BuilderT roles(List<NodeRole> list) {
* Adds one or more values to <code>roles</code>.
* </p>
*/
@Nonnull
public final BuilderT roles(NodeRole value, NodeRole... values) {
this.roles = _listAdd(this.roles, value, values);
return self();
Expand All @@ -271,12 +301,12 @@ public final BuilderT roles(NodeRole value, NodeRole... values) {
/**
* API name: {@code transport_address}
*/
@Nonnull
public final BuilderT transportAddress(@Nullable String value) {
this.transportAddress = value;
return self();
}

protected abstract BuilderT self();
}

// ---------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit d6604c6

Please sign in to comment.