Skip to content

Commit

Permalink
Begin generating index CRUD operations (#1220)
Browse files Browse the repository at this point in the history
* Generate indices.get

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

* Generate indices.exists

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

* Generate indices.create

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

* Generate indices.delete

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

* Cleanup SourceFieldMode

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

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Oct 31, 2024
1 parent fb46101 commit b962e89
Show file tree
Hide file tree
Showing 57 changed files with 2,749 additions and 1,446 deletions.
8 changes: 7 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ After:
- The `name` field, getter and builder method have been renamed to `repository`.

### CloneSnapshotRequest timeout removal
- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch.
- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch.

### DynamicMapping
- Removed the `Runtime` variant from the `DynamicMapping` enum as it is not supported by OpenSearch.

### TypeMapping
- Removed the `runtime` field, getter and builder methods from `TypeMapping` as it is not supported by OpenSearch.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient;
import org.opensearch.client.opensearch.indices.OpenSearchIndicesAsyncClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient;
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient;
Expand All @@ -66,6 +67,10 @@ public OpenSearchDanglingIndicesAsyncClient danglingIndices() {
return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchIndicesAsyncClient indices() {
return new OpenSearchIndicesAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchMlAsyncClient ml() {
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient;
import org.opensearch.client.opensearch.indices.OpenSearchIndicesClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlClient;
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient;
Expand All @@ -65,6 +66,10 @@ public OpenSearchDanglingIndicesClient danglingIndices() {
return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions);
}

public OpenSearchIndicesClient indices() {
return new OpenSearchIndicesClient(this.transport, this.transportOptions);
}

public OpenSearchMlClient ml() {
return new OpenSearchMlClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,33 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types;

import javax.annotation.Generated;
import org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.ExpandWildcard

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum ExpandWildcard implements JsonEnum {
/**
* Match any data stream or index, including hidden ones.
* Match any index, including hidden ones.
*/
All("all"),

/**
* Match open, non-hidden indices. Also matches any non-hidden data stream.
*/
Open("open"),

/**
* Match closed, non-hidden indices. Also matches any non-hidden data stream.
* Data streams cannot be closed.
* Match closed, non-hidden indices.
*/
Closed("closed"),

/**
* Match hidden data streams and hidden indices. Must be combined with open,
* closed, or both.
* Match hidden indices. Must be combined with open, closed, or both.
*/
Hidden("hidden"),

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

;
/**
* Match open, non-hidden indices.
*/
Open("open");

private final String jsonValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,34 @@
* 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.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.util.ObjectBuilder;

// typedef: _types.IndicesResponseBase

@Generated("org.opensearch.client.codegen.CodeGenerator")
public abstract class IndicesResponseBase extends AcknowledgedResponseBase {

@Nullable
private final ShardStatistics shards;

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

protected IndicesResponseBase(AbstractBuilder<?> builder) {
super(builder);

this.shards = builder.shards;

}

/**
Expand All @@ -63,16 +69,15 @@ public final ShardStatistics shards() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

super.serializeInternal(generator, mapper);
if (this.shards != null) {
generator.writeKey("_shards");
this.shards.serialize(generator, mapper);

}

}

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

protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>> extends
AcknowledgedResponseBase.AbstractBuilder<BuilderT> {
@Nullable
Expand All @@ -90,18 +95,35 @@ public final BuilderT shards(@Nullable ShardStatistics value) {
* API name: {@code _shards}
*/
public final BuilderT shards(Function<ShardStatistics.Builder, ObjectBuilder<ShardStatistics>> fn) {
return this.shards(fn.apply(new ShardStatistics.Builder()).build());
return shards(fn.apply(new ShardStatistics.Builder()).build());
}

}

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

protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupIndicesResponseBaseDeserializer(
ObjectDeserializer<BuilderT> op
) {
setupAcknowledgedResponseBaseDeserializer(op);
op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards");
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.shards);
return result;
}

@Override
public boolean equals(Object o) {
if (!super.equals(o)) {
return false;
}
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
IndicesResponseBase other = (IndicesResponseBase) o;
return Objects.equals(this.shards, other.shards);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,24 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types;

import javax.annotation.Generated;
import org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.WaitForActiveShardOptions

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum WaitForActiveShardOptions implements JsonEnum {
All("all"),

;
IndexSetting("index-setting");

private final String jsonValue;

Expand Down
Loading

0 comments on commit b962e89

Please sign in to comment.