Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport/backport 489 to 2.x #496

Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix AwsSdk2TransportOptions.responseCompression ([#322](https://github.com/opensearch-project/opensearch-java/pull/322))
- Fix missing Highlight and SourceConfig in the MultisearchBody ([#442](https://github.com/opensearch-project/opensearch-java/pull/442))
- Fix parsing /_alias error response for not existing alias ([#476](https://github.com/opensearch-project/opensearch-java/pull/476))

- Fix StoryStats numeric value out of range of int ([#489](https://github.com/opensearch-project/opensearch-java/pull/489))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ public class StoreStats implements JsonpSerializable {
@Nullable
private final String size;

private final int sizeInBytes;
private final long sizeInBytes;

@Nullable
private final String reserved;

private final int reservedInBytes;
private final long reservedInBytes;

@Nullable
private final String totalDataSetSize;

@Nullable
private final Integer totalDataSetSizeInBytes;
private final Long totalDataSetSizeInBytes;

// ---------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -98,7 +98,7 @@ public final String size() {
/**
* Required - API name: {@code size_in_bytes}
*/
public final int sizeInBytes() {
public final long sizeInBytes() {
return this.sizeInBytes;
}

Expand All @@ -113,7 +113,7 @@ public final String reserved() {
/**
* Required - API name: {@code reserved_in_bytes}
*/
public final int reservedInBytes() {
public final long reservedInBytes() {
return this.reservedInBytes;
}

Expand All @@ -129,7 +129,7 @@ public final String totalDataSetSize() {
* API name: {@code total_data_set_size_in_bytes}
*/
@Nullable
public final Integer totalDataSetSizeInBytes() {
public final Long totalDataSetSizeInBytes() {
return this.totalDataSetSizeInBytes;
}

Expand Down Expand Up @@ -183,18 +183,18 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<S
@Nullable
private String size;

private Integer sizeInBytes;
private Long sizeInBytes;

@Nullable
private String reserved;

private Integer reservedInBytes;
private Long reservedInBytes;

@Nullable
private String totalDataSetSize;

@Nullable
private Integer totalDataSetSizeInBytes;
private Long totalDataSetSizeInBytes;

/**
* API name: {@code size}
Expand All @@ -207,7 +207,7 @@ public final Builder size(@Nullable String value) {
/**
* Required - API name: {@code size_in_bytes}
*/
public final Builder sizeInBytes(int value) {
public final Builder sizeInBytes(long value) {
this.sizeInBytes = value;
return this;
}
Expand All @@ -223,7 +223,7 @@ public final Builder reserved(@Nullable String value) {
/**
* Required - API name: {@code reserved_in_bytes}
*/
public final Builder reservedInBytes(int value) {
public final Builder reservedInBytes(long value) {
this.reservedInBytes = value;
return this;
}
Expand All @@ -239,7 +239,7 @@ public final Builder totalDataSetSize(@Nullable String value) {
/**
* API name: {@code total_data_set_size_in_bytes}
*/
public final Builder totalDataSetSizeInBytes(@Nullable Integer value) {
public final Builder totalDataSetSizeInBytes(@Nullable Long value) {
this.totalDataSetSizeInBytes = value;
return this;
}
Expand Down Expand Up @@ -268,11 +268,11 @@ public StoreStats build() {
protected static void setupStoreStatsDeserializer(ObjectDeserializer<StoreStats.Builder> op) {

op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size");
op.add(Builder::sizeInBytes, JsonpDeserializer.integerDeserializer(), "size_in_bytes");
op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes");
op.add(Builder::reserved, JsonpDeserializer.stringDeserializer(), "reserved");
op.add(Builder::reservedInBytes, JsonpDeserializer.integerDeserializer(), "reserved_in_bytes");
op.add(Builder::reservedInBytes, JsonpDeserializer.longDeserializer(), "reserved_in_bytes");
op.add(Builder::totalDataSetSize, JsonpDeserializer.stringDeserializer(), "total_data_set_size");
op.add(Builder::totalDataSetSizeInBytes, JsonpDeserializer.integerDeserializer(),
op.add(Builder::totalDataSetSizeInBytes, JsonpDeserializer.longDeserializer(),
"total_data_set_size_in_bytes");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.TreeSet;

public abstract class OpenSearchJavaClientTestCase extends OpenSearchRestTestCase implements OpenSearchTransportSupport {
private static final List<String> systemIndices = List.of(".opensearch-observability", ".opendistro_security");
private static OpenSearchClient javaClient;
private static OpenSearchClient adminJavaClient;

Expand Down Expand Up @@ -137,7 +138,7 @@ protected void wipeAllOSIndices() throws IOException {
.indices(r -> r.headers("index,creation.date").expandWildcards(ExpandWildcard.All));

for (IndicesRecord index : response.valueBody()) {
if (index.index() != null && !".opendistro_security".equals(index.index())) {
if (index.index() != null && !systemIndices.contains(index.index())) {
adminJavaClient().indices().delete(new DeleteIndexRequest.Builder().index(index.index()).build());
}
}
Expand Down