Skip to content

Commit

Permalink
Generate majority of indices operations (#1360)
Browse files Browse the repository at this point in the history
* Generate indices.clone

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.close

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.flush

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.forcemerge

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.get_upgrade

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.open

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.recovery

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.refresh

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.resolve_index

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.rollover

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.segments

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.shard_stores

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.shrink

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.split

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.stats

Signed-off-by: Thomas Farr <[email protected]>

* Remove deserializing of path params

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.upgrade

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.validate_query

Signed-off-by: Thomas Farr <[email protected]>

* Simplify operation filtering

Signed-off-by: Thomas Farr <[email protected]>

* RemoteStoreUploadStats.pressure as optional

Signed-off-by: Thomas Farr <[email protected]>

* Handle segment replication stats returning strings in some versions

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Dec 22, 2024
1 parent 5aef053 commit 9f9ea7c
Show file tree
Hide file tree
Showing 144 changed files with 22,773 additions and 10,899 deletions.
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

0 comments on commit 9f9ea7c

Please sign in to comment.