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

Generate majority of indices operations #1360

Merged
merged 21 commits into from
Dec 22, 2024
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
83 changes: 82 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,85 @@ After:

### ExplainAnalyzeToken
- The `endOffset`, `position`, `positionLength`, `startOffset` and `termFrequency` properties have been corrected to be of type `int` instead of `long`.
- The `positionlength` and `termfrequency` properties have had their casing corrected to `positionLength` and `termFrequency` respectively.
- The `positionlength` and `termfrequency` properties have had their casing corrected to `positionLength` and `termFrequency` respectively.

### RecoveryBytes
- The `recoveredFromSnapshotInBytes`, `recoveredInBytes`, `reusedInBytes` and `totalInBytes` properties have been corrected to be of type `long` instead of `String`.

### RecoveryIndexStatus
- The `sourceThrottleTimeInMillis`, `targetThrottleTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`.

### RecoveryOrigin
- The `restoreuuid` property has had its casing corrected to `restoreUuid`.

### RecoveryStartStatus
- The `checkIndexTime` property has been corrected to be of type `Time` instead of `long`.
- The `totalTimeInMillis` property has been corrected to be of type `long` instead of `String`.

### ShardRecovery
- The `id` property has been corrected to be of type `int` instead of `long`.
- The `startTimeInMillis`, `stopTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`.
- The `totalTime` property has been corrected to be of type `Time` instead of `String`.

### indices.recovery.TranslogStatus
- The `recovered`, `total` and `totalOnStart` properties have been corrected to be of type `int` instead of `long`.
- The `totalTime` property has been corrected to be of type `Time` instead of `String`.
- The `totalTimeInMillis` property has been corrected to be of type `long` instead of `String`.

### indices.recovery.VerifyIndex
- The `checkIndexTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`.

### RolloverRequest
- The `mappings` property is now of type `TypeMapping` instead of `IndexRolloverMapping`.

### IndexRolloverMapping
- The `IndexRolloverMapping` class has been removed.

### Segment
- The `deletedDocs` and `numDocs` properties have been corrected to be of type `int` instead of `long`.
- The `memoryInBytes` and `sizeInBytes` properties have been corrected to be of type `long` instead of `double`.

### ShardStore
- The `attributes`, `id`, `legacyVersion`, `name` and `transportAddress` properties have been removed and are now correctly nested within the `NodeAttributes` under the `nodes` property map.

### FlushStats
- The `totalTime` property has been corrected to be of type `Time` instead of `String`.

### GetStats
- The `existsTime`, `missingTime` and `time` properties have been corrected to be of type `Time` instead of `String`.

### IndexingStats
- The `deleteTime`, `indexTime` and `throttleTime` properties have been corrected to be of type `Time` instead of `String`.
- The `types` property has been removed as it is no longer supported by OpenSearch as of version 2.0.0.

### MergesStats
- The `totalStoppedTime`, `totalThrottledTime` and `totalTime` properties have been corrected to be of type `Time` instead of `String`.

### RecoveryStats
- The `throttleTime` property has been corrected to be of type `Time` instead of `String`.

### RefreshStats
- The `totalTime` property has been corrected to be of type `Time` instead of `String`.

### SegmentsStats
- The `storedMemory` property has been renamed to `storedFieldsMemory` to match the OpenSearch response.

### StoreStats
- The `totalDataSetSize` and `totalDataSetSizeInBytes` properties have been removed as they are not returned by OpenSearch.

### TranslogStats
- The `operations` property has been corrected to be of type `int` instead of `long`.

### WarmerStats
- The `totalTime` property has been corrected to be of type `Time` instead of `String`.

### IndicesStatsRequest
- The `metric` property is now of type `List<IndicesStatsMetric>` instead of `List<String>`.
- The `types` property has been removed as it is no longer supported by OpenSearch as of version 2.0.0.

### IndicesStatsResponse
- The `all` property is now of type `AllIndicesStats` instead of `IndicesStats`.

### ShardStats renamed to IndexShardStats
- The `ShardStats` class has been renamed to `IndexShardStats`, this affects:
- `IndicesStats`'s `shards` field.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -43,39 +50,43 @@
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: _types.CompletionStats

@JsonpDeserializable
public class CompletionStats implements PlainJsonSerializable {
private final long sizeInBytes;
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class CompletionStats implements PlainJsonSerializable, ToCopyableBuilder<CompletionStats.Builder, CompletionStats> {

@Nonnull
private final Map<String, FieldSizeUsage> fields;

@Nullable
private final String size;

private final Map<String, FieldSizeUsage> fields;
private final long sizeInBytes;

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

private CompletionStats(Builder builder) {

this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes");
this.size = builder.size;
this.fields = ApiTypeHelper.unmodifiable(builder.fields);

this.size = builder.size;
this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes");
}

public static CompletionStats of(Function<Builder, ObjectBuilder<CompletionStats>> fn) {
public static CompletionStats of(Function<CompletionStats.Builder, ObjectBuilder<CompletionStats>> fn) {
return fn.apply(new Builder()).build();
}

/**
* Required - API name: {@code size_in_bytes}
* API name: {@code fields}
*/
public final long sizeInBytes() {
return this.sizeInBytes;
@Nonnull
public final Map<String, FieldSizeUsage> fields() {
return this.fields;
}

/**
Expand All @@ -87,111 +98,154 @@ public final String size() {
}

/**
* API name: {@code fields}
* Required - The total amount, in bytes, of memory used for completion across all shards assigned to the selected nodes.
* <p>
* API name: {@code size_in_bytes}
* </p>
*/
public final Map<String, FieldSizeUsage> fields() {
return this.fields;
public final long sizeInBytes() {
return this.sizeInBytes;
}

/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("size_in_bytes");
generator.write(this.sizeInBytes);

if (this.size != null) {
generator.writeKey("size");
generator.write(this.size);

}
if (ApiTypeHelper.isDefined(this.fields)) {
generator.writeKey("fields");
generator.writeStartObject();
for (Map.Entry<String, FieldSizeUsage> item0 : this.fields.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);

}
generator.writeEnd();
}

if (this.size != null) {
generator.writeKey("size");
generator.write(this.size);
}

generator.writeKey("size_in_bytes");
generator.write(this.sizeInBytes);
}

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

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link CompletionStats}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CompletionStats> {
private Long sizeInBytes;

public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, CompletionStats> {
@Nullable
private Map<String, FieldSizeUsage> fields;
@Nullable
private String size;
private Long sizeInBytes;

@Nullable
private Map<String, FieldSizeUsage> fields;
public Builder() {}

/**
* Required - API name: {@code size_in_bytes}
*/
public final Builder sizeInBytes(long value) {
this.sizeInBytes = value;
return this;
private Builder(CompletionStats o) {
this.fields = _mapCopy(o.fields);
this.size = o.size;
this.sizeInBytes = o.sizeInBytes;
}

/**
* API name: {@code size}
*/
public final Builder size(@Nullable String value) {
this.size = value;
return this;
private Builder(Builder o) {
this.fields = _mapCopy(o.fields);
this.size = o.size;
this.sizeInBytes = o.sizeInBytes;
}

@Override
@Nonnull
public Builder copy() {
return new Builder(this);
}

/**
* API name: {@code fields}
*
* <p>
* Adds all entries of <code>map</code> to <code>fields</code>.
* Adds all elements of <code>map</code> to <code>fields</code>.
* </p>
*/
@Nonnull
public final Builder fields(Map<String, FieldSizeUsage> map) {
this.fields = _mapPutAll(this.fields, map);
return this;
}

/**
* API name: {@code fields}
*
* <p>
* Adds an entry to <code>fields</code>.
* </p>
*/
@Nonnull
public final Builder fields(String key, FieldSizeUsage value) {
this.fields = _mapPut(this.fields, key, value);
return this;
}

/**
* API name: {@code fields}
*
* <p>
* Adds an entry to <code>fields</code> using a builder lambda.
* Adds a value to <code>fields</code> using a builder lambda.
* </p>
*/
@Nonnull
public final Builder fields(String key, Function<FieldSizeUsage.Builder, ObjectBuilder<FieldSizeUsage>> fn) {
return fields(key, fn.apply(new FieldSizeUsage.Builder()).build());
}

/**
* API name: {@code size}
*/
@Nonnull
public final Builder size(@Nullable String value) {
this.size = value;
return this;
}

/**
* Required - The total amount, in bytes, of memory used for completion across all shards assigned to the selected nodes.
* <p>
* API name: {@code size_in_bytes}
* </p>
*/
@Nonnull
public final Builder sizeInBytes(long value) {
this.sizeInBytes = value;
return this;
}

/**
* Builds a {@link CompletionStats}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public CompletionStats build() {
_checkSingleUse();

Expand All @@ -210,11 +264,25 @@ public CompletionStats build() {
);

protected static void setupCompletionStatsDeserializer(ObjectDeserializer<CompletionStats.Builder> op) {

op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes");
op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size");
op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields");
op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size");
op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes");
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + Objects.hashCode(this.fields);
result = 31 * result + Objects.hashCode(this.size);
result = 31 * result + Long.hashCode(this.sizeInBytes);
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
CompletionStats other = (CompletionStats) o;
return Objects.equals(this.fields, other.fields) && Objects.equals(this.size, other.size) && this.sizeInBytes == other.sizeInBytes;
}
}
Loading
Loading