Skip to content

Commit f0d2501

Browse files
Xtansiaopensearch-trigger-bot[bot]github-actions[bot]
authored
Re-generated client code using latest OpenSearch API specification (#1589) (#1592)
* Re-generate client code using latest OpenSearch API specification (2025-06-02) (#1586) (cherry picked from commit 3a72913) * changelog --------- (cherry picked from commit 436c558) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Thomas Farr <tsfarr@amazon.com> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 1be43d1 commit f0d2501

22 files changed

Lines changed: 1762 additions & 932 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
33

44
## [Unreleased 2.x]
55
### Added
6+
- Added support for the `template` query type ([#1586](https://github.com/opensearch-project/opensearch-java/pull/1586))
7+
- Added support for Search Shards request `slice` property ([#1586](https://github.com/opensearch-project/opensearch-java/pull/1586))
68

79
### Dependencies
810
- Bump `org.junit:junit-bom` from 5.12.2 to 5.13.0 ([#1587](https://github.com/opensearch-project/opensearch-java/pull/1587))
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
/*
10+
* Licensed to Elasticsearch B.V. under one or more contributor
11+
* license agreements. See the NOTICE file distributed with
12+
* this work for additional information regarding copyright
13+
* ownership. Elasticsearch B.V. licenses this file to you under
14+
* the Apache License, Version 2.0 (the "License"); you may
15+
* not use this file except in compliance with the License.
16+
* You may obtain a copy of the License at
17+
*
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
*
20+
* Unless required by applicable law or agreed to in writing,
21+
* software distributed under the License is distributed on an
22+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23+
* KIND, either express or implied. See the License for the
24+
* specific language governing permissions and limitations
25+
* under the License.
26+
*/
27+
28+
/*
29+
* Modifications Copyright OpenSearch Contributors. See
30+
* GitHub history for details.
31+
*/
32+
33+
//----------------------------------------------------
34+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35+
//----------------------------------------------------
36+
37+
package org.opensearch.client.opensearch;
38+
39+
import java.io.IOException;
40+
import java.util.concurrent.CompletableFuture;
41+
import java.util.function.Function;
42+
import javax.annotation.Generated;
43+
import javax.annotation.Nullable;
44+
import org.opensearch.client.ApiClient;
45+
import org.opensearch.client.opensearch._types.OpenSearchException;
46+
import org.opensearch.client.opensearch.core.SearchShardsRequest;
47+
import org.opensearch.client.opensearch.core.SearchShardsResponse;
48+
import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient;
49+
import org.opensearch.client.opensearch.search_pipeline.OpenSearchSearchPipelineAsyncClient;
50+
import org.opensearch.client.transport.OpenSearchTransport;
51+
import org.opensearch.client.transport.TransportOptions;
52+
import org.opensearch.client.util.ObjectBuilder;
53+
54+
/**
55+
* Client for the namespace.
56+
*/
57+
@Generated("org.opensearch.client.codegen.CodeGenerator")
58+
public abstract class OpenSearchAsyncClientBase<Self extends OpenSearchAsyncClientBase<Self>> extends ApiClient<OpenSearchTransport, Self> {
59+
public OpenSearchAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
60+
super(transport, transportOptions);
61+
}
62+
63+
// ----- Child clients
64+
65+
public OpenSearchMlAsyncClient ml() {
66+
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
67+
}
68+
69+
public OpenSearchSearchPipelineAsyncClient searchPipeline() {
70+
return new OpenSearchSearchPipelineAsyncClient(this.transport, this.transportOptions);
71+
}
72+
73+
// ----- Endpoint: search_shards
74+
75+
/**
76+
* Returns information about the indexes and shards that a search request would be executed against.
77+
*/
78+
public CompletableFuture<SearchShardsResponse> searchShards(SearchShardsRequest request) throws IOException, OpenSearchException {
79+
return this.transport.performRequestAsync(request, SearchShardsRequest._ENDPOINT, this.transportOptions);
80+
}
81+
82+
/**
83+
* Returns information about the indexes and shards that a search request would be executed against.
84+
*
85+
* @param fn a function that initializes a builder to create the {@link SearchShardsRequest}
86+
*/
87+
public final CompletableFuture<SearchShardsResponse> searchShards(
88+
Function<SearchShardsRequest.Builder, ObjectBuilder<SearchShardsRequest>> fn
89+
) throws IOException, OpenSearchException {
90+
return searchShards(fn.apply(new SearchShardsRequest.Builder()).build());
91+
}
92+
93+
/**
94+
* Returns information about the indexes and shards that a search request would be executed against.
95+
*/
96+
public final CompletableFuture<SearchShardsResponse> searchShards() throws IOException, OpenSearchException {
97+
return searchShards(new SearchShardsRequest.Builder().build());
98+
}
99+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
/*
10+
* Licensed to Elasticsearch B.V. under one or more contributor
11+
* license agreements. See the NOTICE file distributed with
12+
* this work for additional information regarding copyright
13+
* ownership. Elasticsearch B.V. licenses this file to you under
14+
* the Apache License, Version 2.0 (the "License"); you may
15+
* not use this file except in compliance with the License.
16+
* You may obtain a copy of the License at
17+
*
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
*
20+
* Unless required by applicable law or agreed to in writing,
21+
* software distributed under the License is distributed on an
22+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23+
* KIND, either express or implied. See the License for the
24+
* specific language governing permissions and limitations
25+
* under the License.
26+
*/
27+
28+
/*
29+
* Modifications Copyright OpenSearch Contributors. See
30+
* GitHub history for details.
31+
*/
32+
33+
//----------------------------------------------------
34+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35+
//----------------------------------------------------
36+
37+
package org.opensearch.client.opensearch;
38+
39+
import java.io.IOException;
40+
import java.util.function.Function;
41+
import javax.annotation.Generated;
42+
import javax.annotation.Nullable;
43+
import org.opensearch.client.ApiClient;
44+
import org.opensearch.client.opensearch._types.OpenSearchException;
45+
import org.opensearch.client.opensearch.core.SearchShardsRequest;
46+
import org.opensearch.client.opensearch.core.SearchShardsResponse;
47+
import org.opensearch.client.opensearch.ml.OpenSearchMlClient;
48+
import org.opensearch.client.opensearch.search_pipeline.OpenSearchSearchPipelineClient;
49+
import org.opensearch.client.transport.OpenSearchTransport;
50+
import org.opensearch.client.transport.TransportOptions;
51+
import org.opensearch.client.util.ObjectBuilder;
52+
53+
/**
54+
* Client for the namespace.
55+
*/
56+
@Generated("org.opensearch.client.codegen.CodeGenerator")
57+
public abstract class OpenSearchClientBase<Self extends OpenSearchClientBase<Self>> extends ApiClient<OpenSearchTransport, Self> {
58+
public OpenSearchClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
59+
super(transport, transportOptions);
60+
}
61+
62+
// ----- Child clients
63+
64+
public OpenSearchMlClient ml() {
65+
return new OpenSearchMlClient(this.transport, this.transportOptions);
66+
}
67+
68+
public OpenSearchSearchPipelineClient searchPipeline() {
69+
return new OpenSearchSearchPipelineClient(this.transport, this.transportOptions);
70+
}
71+
72+
// ----- Endpoint: search_shards
73+
74+
/**
75+
* Returns information about the indexes and shards that a search request would be executed against.
76+
*/
77+
public SearchShardsResponse searchShards(SearchShardsRequest request) throws IOException, OpenSearchException {
78+
return this.transport.performRequest(request, SearchShardsRequest._ENDPOINT, this.transportOptions);
79+
}
80+
81+
/**
82+
* Returns information about the indexes and shards that a search request would be executed against.
83+
*
84+
* @param fn a function that initializes a builder to create the {@link SearchShardsRequest}
85+
*/
86+
public final SearchShardsResponse searchShards(Function<SearchShardsRequest.Builder, ObjectBuilder<SearchShardsRequest>> fn)
87+
throws IOException, OpenSearchException {
88+
return searchShards(fn.apply(new SearchShardsRequest.Builder()).build());
89+
}
90+
91+
/**
92+
* Returns information about the indexes and shards that a search request would be executed against.
93+
*/
94+
public final SearchShardsResponse searchShards() throws IOException, OpenSearchException {
95+
return searchShards(new SearchShardsRequest.Builder().build());
96+
}
97+
}

java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java renamed to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,33 @@
3030
* GitHub history for details.
3131
*/
3232

33+
//----------------------------------------------------
34+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35+
//----------------------------------------------------
36+
3337
package org.opensearch.client.opensearch._types;
3438

39+
import javax.annotation.Generated;
3540
import org.opensearch.client.json.JsonEnum;
3641
import org.opensearch.client.json.JsonpDeserializable;
3742

43+
// typedef: _types.ExpandWildcard
44+
3845
@JsonpDeserializable
46+
@Generated("org.opensearch.client.codegen.CodeGenerator")
3947
public enum ExpandWildcard implements JsonEnum {
4048
/**
41-
* Match any data stream or index, including hidden ones.
49+
* Match any index, including hidden ones.
4250
*/
4351
All("all"),
4452

4553
/**
46-
* Match open, non-hidden indices. Also matches any non-hidden data stream.
47-
*/
48-
Open("open"),
49-
50-
/**
51-
* Match closed, non-hidden indices. Also matches any non-hidden data stream.
52-
* Data streams cannot be closed.
54+
* Match closed, non-hidden indexes.
5355
*/
5456
Closed("closed"),
5557

5658
/**
57-
* Match hidden data streams and hidden indices. Must be combined with open,
58-
* closed, or both.
59+
* Match hidden indexes. Must be combined with open, closed, or both.
5960
*/
6061
Hidden("hidden"),
6162

@@ -64,7 +65,10 @@ public enum ExpandWildcard implements JsonEnum {
6465
*/
6566
None("none"),
6667

67-
;
68+
/**
69+
* Match open, non-hidden indexes.
70+
*/
71+
Open("open");
6872

6973
private final String jsonValue;
7074

0 commit comments

Comments
 (0)