Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bump `com.github.jk1.dependency-license-report` from 3.0.1 to 3.1.1 ([#1895](https://github.com/opensearch-project/opensearch-java/pull/1895), [#1896](https://github.com/opensearch-project/opensearch-java/pull/1896))

### Added
- Add msearch `allow_partial_results` flag ([#1904](https://github.com/opensearch-project/opensearch-java/pull/1904))

### Fixed
- Fix formatting of the main method to run for various samples ([#1749](https://github.com/opensearch-project/opensearch-java/pull/1749))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public class MsearchRequest extends RequestBase implements NdJsonpSerializable,
@Nullable
private final Boolean ccsMinimizeRoundtrips;

@Nullable
private final Boolean allowPartialResults;

private final List<ExpandWildcard> expandWildcards;

@Nullable
Expand Down Expand Up @@ -104,6 +107,7 @@ private MsearchRequest(Builder builder) {
this.allowNoIndices = builder.allowNoIndices;
this.cancelAfterTimeInterval = builder.cancelAfterTimeInterval;
this.ccsMinimizeRoundtrips = builder.ccsMinimizeRoundtrips;
this.allowPartialResults = builder.allowPartialResults;
this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards);
this.ignoreThrottled = builder.ignoreThrottled;
this.ignoreUnavailable = builder.ignoreUnavailable;
Expand Down Expand Up @@ -161,6 +165,16 @@ public final Boolean ccsMinimizeRoundtrips() {
return this.ccsMinimizeRoundtrips;
}

/**
* If true, return partial results if there are shard request timeouts or shard failures.
* <p>
* API name: {@code allow_partial_results}
*/
@Nullable
public final Boolean allowPartialResults() {
return this.allowPartialResults;
}

/**
* Type of index that wildcard expressions can match. If the request can target
* data streams, this argument determines whether wildcard expressions match
Expand Down Expand Up @@ -274,6 +288,7 @@ public Builder toBuilder() {
return new Builder().allowNoIndices(allowNoIndices)
.cancelAfterTimeInterval(cancelAfterTimeInterval)
.ccsMinimizeRoundtrips(ccsMinimizeRoundtrips)
.allowPartialResults(allowPartialResults)
.expandWildcards(expandWildcards)
.ignoreThrottled(ignoreThrottled)
.ignoreUnavailable(ignoreUnavailable)
Expand Down Expand Up @@ -301,6 +316,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<M
@Nullable
private Boolean ccsMinimizeRoundtrips;

@Nullable
private Boolean allowPartialResults;

@Nullable
private List<ExpandWildcard> expandWildcards;

Expand Down Expand Up @@ -373,6 +391,16 @@ public final Builder ccsMinimizeRoundtrips(@Nullable Boolean value) {
return this;
}

/**
* If true, return partial results if there are shard request timeouts or shard failures.
* <p>
* API name: {@code allow_partial_results}
*/
public final Builder allowPartialResults(@Nullable Boolean value) {
this.allowPartialResults = value;
return this;
}

/**
* Type of index that wildcard expressions can match. If the request can target
* data streams, this argument determines whether wildcard expressions match
Expand Down Expand Up @@ -611,6 +639,9 @@ public MsearchRequest build() {
if (request.ccsMinimizeRoundtrips != null) {
params.put("ccs_minimize_roundtrips", String.valueOf(request.ccsMinimizeRoundtrips));
}
if (request.allowPartialResults != null) {
params.put("allow_partial_results", String.valueOf(request.allowPartialResults));
}
return params;

},
Expand Down
Loading