diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82b9452222..a17640ea09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Make ChildrenAggregate as a SingleBucketAggregate ([#306](https://github.com/opensearch-project/opensearch-java/pull/306))
+- Fix /_nodes/stats, /_nodes/info throwing serialization error ([#315](https://github.com/opensearch-project/opensearch-java/pull/315))
### Security
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java
index 0aca1805c0..9f9cbdc20c 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java
@@ -69,10 +69,6 @@ public class PluginStats implements JsonpSerializable {
private final String version;
- private final boolean licensed;
-
- private final String type;
-
// ---------------------------------------------------------------------------------------------
private PluginStats(Builder builder) {
@@ -87,8 +83,6 @@ private PluginStats(Builder builder) {
this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion");
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version");
- this.licensed = ApiTypeHelper.requireNonNull(builder.licensed, this, "licensed");
- this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
}
@@ -152,20 +146,6 @@ public final String version() {
return this.version;
}
- /**
- * Required - API name: {@code licensed}
- */
- public final boolean licensed() {
- return this.licensed;
- }
-
- /**
- * Required - API name: {@code type}
- */
- public final String type() {
- return this.type;
- }
-
/**
* Serialize this object to JSON.
*/
@@ -207,13 +187,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("version");
generator.write(this.version);
-
- generator.writeKey("licensed");
- generator.write(this.licensed);
-
- generator.writeKey("type");
- generator.write(this.type);
-
}
// ---------------------------------------------------------------------------------------------
@@ -239,10 +212,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder
{
private Long avgQueueSize;
- private Long avgResponseTime;
-
private Long avgResponseTimeNs;
- private String avgServiceTime;
-
private Long avgServiceTimeNs;
private Long outgoingSearches;
@@ -197,14 +167,6 @@ public final Builder avgQueueSize(long value) {
return this;
}
- /**
- * Required - API name: {@code avg_response_time}
- */
- public final Builder avgResponseTime(long value) {
- this.avgResponseTime = value;
- return this;
- }
-
/**
* Required - API name: {@code avg_response_time_ns}
*/
@@ -213,14 +175,6 @@ public final Builder avgResponseTimeNs(long value) {
return this;
}
- /**
- * Required - API name: {@code avg_service_time}
- */
- public final Builder avgServiceTime(String value) {
- this.avgServiceTime = value;
- return this;
- }
-
/**
* Required - API name: {@code avg_service_time_ns}
*/
@@ -269,9 +223,7 @@ public AdaptiveSelection build() {
protected static void setupAdaptiveSelectionDeserializer(ObjectDeserializer op) {
op.add(Builder::avgQueueSize, JsonpDeserializer.longDeserializer(), "avg_queue_size");
- op.add(Builder::avgResponseTime, JsonpDeserializer.longDeserializer(), "avg_response_time");
op.add(Builder::avgResponseTimeNs, JsonpDeserializer.longDeserializer(), "avg_response_time_ns");
- op.add(Builder::avgServiceTime, JsonpDeserializer.stringDeserializer(), "avg_service_time");
op.add(Builder::avgServiceTimeNs, JsonpDeserializer.longDeserializer(), "avg_service_time_ns");
op.add(Builder::outgoingSearches, JsonpDeserializer.longDeserializer(), "outgoing_searches");
op.add(Builder::rank, JsonpDeserializer.stringDeserializer(), "rank");
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/DataPathStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/DataPathStats.java
index 928113fc36..6e24932d03 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/DataPathStats.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/DataPathStats.java
@@ -53,34 +53,14 @@
@JsonpDeserializable
public class DataPathStats implements JsonpSerializable {
- private final String available;
-
private final long availableInBytes;
- private final String diskQueue;
-
- private final long diskReads;
-
- private final String diskReadSize;
-
- private final long diskReadSizeInBytes;
-
- private final long diskWrites;
-
- private final String diskWriteSize;
-
- private final long diskWriteSizeInBytes;
-
- private final String free;
-
private final long freeInBytes;
private final String mount;
private final String path;
- private final String total;
-
private final long totalInBytes;
private final String type;
@@ -89,22 +69,10 @@ public class DataPathStats implements JsonpSerializable {
private DataPathStats(Builder builder) {
- this.available = ApiTypeHelper.requireNonNull(builder.available, this, "available");
this.availableInBytes = ApiTypeHelper.requireNonNull(builder.availableInBytes, this, "availableInBytes");
- this.diskQueue = ApiTypeHelper.requireNonNull(builder.diskQueue, this, "diskQueue");
- this.diskReads = ApiTypeHelper.requireNonNull(builder.diskReads, this, "diskReads");
- this.diskReadSize = ApiTypeHelper.requireNonNull(builder.diskReadSize, this, "diskReadSize");
- this.diskReadSizeInBytes = ApiTypeHelper.requireNonNull(builder.diskReadSizeInBytes, this,
- "diskReadSizeInBytes");
- this.diskWrites = ApiTypeHelper.requireNonNull(builder.diskWrites, this, "diskWrites");
- this.diskWriteSize = ApiTypeHelper.requireNonNull(builder.diskWriteSize, this, "diskWriteSize");
- this.diskWriteSizeInBytes = ApiTypeHelper.requireNonNull(builder.diskWriteSizeInBytes, this,
- "diskWriteSizeInBytes");
- this.free = ApiTypeHelper.requireNonNull(builder.free, this, "free");
this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes");
this.mount = ApiTypeHelper.requireNonNull(builder.mount, this, "mount");
this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path");
- this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");
this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes");
this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
@@ -114,13 +82,6 @@ public static DataPathStats of(Function> f
return fn.apply(new Builder()).build();
}
- /**
- * Required - API name: {@code available}
- */
- public final String available() {
- return this.available;
- }
-
/**
* Required - API name: {@code available_in_bytes}
*/
@@ -128,62 +89,6 @@ public final long availableInBytes() {
return this.availableInBytes;
}
- /**
- * Required - API name: {@code disk_queue}
- */
- public final String diskQueue() {
- return this.diskQueue;
- }
-
- /**
- * Required - API name: {@code disk_reads}
- */
- public final long diskReads() {
- return this.diskReads;
- }
-
- /**
- * Required - API name: {@code disk_read_size}
- */
- public final String diskReadSize() {
- return this.diskReadSize;
- }
-
- /**
- * Required - API name: {@code disk_read_size_in_bytes}
- */
- public final long diskReadSizeInBytes() {
- return this.diskReadSizeInBytes;
- }
-
- /**
- * Required - API name: {@code disk_writes}
- */
- public final long diskWrites() {
- return this.diskWrites;
- }
-
- /**
- * Required - API name: {@code disk_write_size}
- */
- public final String diskWriteSize() {
- return this.diskWriteSize;
- }
-
- /**
- * Required - API name: {@code disk_write_size_in_bytes}
- */
- public final long diskWriteSizeInBytes() {
- return this.diskWriteSizeInBytes;
- }
-
- /**
- * Required - API name: {@code free}
- */
- public final String free() {
- return this.free;
- }
-
/**
* Required - API name: {@code free_in_bytes}
*/
@@ -205,13 +110,6 @@ public final String path() {
return this.path;
}
- /**
- * Required - API name: {@code total}
- */
- public final String total() {
- return this.total;
- }
-
/**
* Required - API name: {@code total_in_bytes}
*/
@@ -237,36 +135,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
- generator.writeKey("available");
- generator.write(this.available);
-
generator.writeKey("available_in_bytes");
generator.write(this.availableInBytes);
- generator.writeKey("disk_queue");
- generator.write(this.diskQueue);
-
- generator.writeKey("disk_reads");
- generator.write(this.diskReads);
-
- generator.writeKey("disk_read_size");
- generator.write(this.diskReadSize);
-
- generator.writeKey("disk_read_size_in_bytes");
- generator.write(this.diskReadSizeInBytes);
-
- generator.writeKey("disk_writes");
- generator.write(this.diskWrites);
-
- generator.writeKey("disk_write_size");
- generator.write(this.diskWriteSize);
-
- generator.writeKey("disk_write_size_in_bytes");
- generator.write(this.diskWriteSizeInBytes);
-
- generator.writeKey("free");
- generator.write(this.free);
-
generator.writeKey("free_in_bytes");
generator.write(this.freeInBytes);
@@ -276,9 +147,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("path");
generator.write(this.path);
- generator.writeKey("total");
- generator.write(this.total);
-
generator.writeKey("total_in_bytes");
generator.write(this.totalInBytes);
@@ -294,46 +162,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
- private String available;
private Long availableInBytes;
- private String diskQueue;
-
- private Long diskReads;
-
- private String diskReadSize;
-
- private Long diskReadSizeInBytes;
-
- private Long diskWrites;
-
- private String diskWriteSize;
-
- private Long diskWriteSizeInBytes;
-
- private String free;
-
private Long freeInBytes;
private String mount;
private String path;
- private String total;
-
private Long totalInBytes;
private String type;
- /**
- * Required - API name: {@code available}
- */
- public final Builder available(String value) {
- this.available = value;
- return this;
- }
-
/**
* Required - API name: {@code available_in_bytes}
*/
@@ -342,70 +183,6 @@ public final Builder availableInBytes(long value) {
return this;
}
- /**
- * Required - API name: {@code disk_queue}
- */
- public final Builder diskQueue(String value) {
- this.diskQueue = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_reads}
- */
- public final Builder diskReads(long value) {
- this.diskReads = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_read_size}
- */
- public final Builder diskReadSize(String value) {
- this.diskReadSize = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_read_size_in_bytes}
- */
- public final Builder diskReadSizeInBytes(long value) {
- this.diskReadSizeInBytes = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_writes}
- */
- public final Builder diskWrites(long value) {
- this.diskWrites = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_write_size}
- */
- public final Builder diskWriteSize(String value) {
- this.diskWriteSize = value;
- return this;
- }
-
- /**
- * Required - API name: {@code disk_write_size_in_bytes}
- */
- public final Builder diskWriteSizeInBytes(long value) {
- this.diskWriteSizeInBytes = value;
- return this;
- }
-
- /**
- * Required - API name: {@code free}
- */
- public final Builder free(String value) {
- this.free = value;
- return this;
- }
-
/**
* Required - API name: {@code free_in_bytes}
*/
@@ -430,14 +207,6 @@ public final Builder path(String value) {
return this;
}
- /**
- * Required - API name: {@code total}
- */
- public final Builder total(String value) {
- this.total = value;
- return this;
- }
-
/**
* Required - API name: {@code total_in_bytes}
*/
@@ -477,20 +246,10 @@ public DataPathStats build() {
protected static void setupDataPathStatsDeserializer(ObjectDeserializer op) {
- op.add(Builder::available, JsonpDeserializer.stringDeserializer(), "available");
op.add(Builder::availableInBytes, JsonpDeserializer.longDeserializer(), "available_in_bytes");
- op.add(Builder::diskQueue, JsonpDeserializer.stringDeserializer(), "disk_queue");
- op.add(Builder::diskReads, JsonpDeserializer.longDeserializer(), "disk_reads");
- op.add(Builder::diskReadSize, JsonpDeserializer.stringDeserializer(), "disk_read_size");
- op.add(Builder::diskReadSizeInBytes, JsonpDeserializer.longDeserializer(), "disk_read_size_in_bytes");
- op.add(Builder::diskWrites, JsonpDeserializer.longDeserializer(), "disk_writes");
- op.add(Builder::diskWriteSize, JsonpDeserializer.stringDeserializer(), "disk_write_size");
- op.add(Builder::diskWriteSizeInBytes, JsonpDeserializer.longDeserializer(), "disk_write_size_in_bytes");
- op.add(Builder::free, JsonpDeserializer.stringDeserializer(), "free");
op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes");
op.add(Builder::mount, JsonpDeserializer.stringDeserializer(), "mount");
op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path");
- op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total");
op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes");
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/FileSystemTotal.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/FileSystemTotal.java
index 64727d5498..0916e4604b 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/FileSystemTotal.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/FileSystemTotal.java
@@ -53,27 +53,18 @@
@JsonpDeserializable
public class FileSystemTotal implements JsonpSerializable {
- private final String available;
-
private final long availableInBytes;
- private final String free;
-
private final long freeInBytes;
- private final String total;
-
private final long totalInBytes;
// ---------------------------------------------------------------------------------------------
private FileSystemTotal(Builder builder) {
- this.available = ApiTypeHelper.requireNonNull(builder.available, this, "available");
this.availableInBytes = ApiTypeHelper.requireNonNull(builder.availableInBytes, this, "availableInBytes");
- this.free = ApiTypeHelper.requireNonNull(builder.free, this, "free");
this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes");
- this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");
this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes");
}
@@ -82,13 +73,6 @@ public static FileSystemTotal of(Function {
- private String available;
private Long availableInBytes;
- private String free;
-
private Long freeInBytes;
- private String total;
-
private Long totalInBytes;
- /**
- * Required - API name: {@code available}
- */
- public final Builder available(String value) {
- this.available = value;
- return this;
- }
-
/**
* Required - API name: {@code available_in_bytes}
*/
@@ -190,13 +139,6 @@ public final Builder availableInBytes(long value) {
return this;
}
- /**
- * Required - API name: {@code free}
- */
- public final Builder free(String value) {
- this.free = value;
- return this;
- }
/**
* Required - API name: {@code free_in_bytes}
@@ -206,14 +148,6 @@ public final Builder freeInBytes(long value) {
return this;
}
- /**
- * Required - API name: {@code total}
- */
- public final Builder total(String value) {
- this.total = value;
- return this;
- }
-
/**
* Required - API name: {@code total_in_bytes}
*/
@@ -245,11 +179,8 @@ public FileSystemTotal build() {
protected static void setupFileSystemTotalDeserializer(ObjectDeserializer op) {
- op.add(Builder::available, JsonpDeserializer.stringDeserializer(), "available");
op.add(Builder::availableInBytes, JsonpDeserializer.longDeserializer(), "available_in_bytes");
- op.add(Builder::free, JsonpDeserializer.stringDeserializer(), "free");
op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes");
- op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total");
op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/GarbageCollectorTotal.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/GarbageCollectorTotal.java
index 2d5abaf5b2..248ef171ca 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/GarbageCollectorTotal.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/GarbageCollectorTotal.java
@@ -55,8 +55,6 @@
public class GarbageCollectorTotal implements JsonpSerializable {
private final long collectionCount;
- private final String collectionTime;
-
private final long collectionTimeInMillis;
// ---------------------------------------------------------------------------------------------
@@ -64,7 +62,6 @@ public class GarbageCollectorTotal implements JsonpSerializable {
private GarbageCollectorTotal(Builder builder) {
this.collectionCount = ApiTypeHelper.requireNonNull(builder.collectionCount, this, "collectionCount");
- this.collectionTime = ApiTypeHelper.requireNonNull(builder.collectionTime, this, "collectionTime");
this.collectionTimeInMillis = ApiTypeHelper.requireNonNull(builder.collectionTimeInMillis, this,
"collectionTimeInMillis");
@@ -81,13 +78,6 @@ public final long collectionCount() {
return this.collectionCount;
}
- /**
- * Required - API name: {@code collection_time}
- */
- public final String collectionTime() {
- return this.collectionTime;
- }
-
/**
* Required - API name: {@code collection_time_in_millis}
*/
@@ -109,9 +99,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("collection_count");
generator.write(this.collectionCount);
- generator.writeKey("collection_time");
- generator.write(this.collectionTime);
-
generator.writeKey("collection_time_in_millis");
generator.write(this.collectionTimeInMillis);
@@ -126,8 +113,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
private Long collectionCount;
- private String collectionTime;
-
private Long collectionTimeInMillis;
/**
@@ -138,14 +123,6 @@ public final Builder collectionCount(long value) {
return this;
}
- /**
- * Required - API name: {@code collection_time}
- */
- public final Builder collectionTime(String value) {
- this.collectionTime = value;
- return this;
- }
-
/**
* Required - API name: {@code collection_time_in_millis}
*/
@@ -178,7 +155,6 @@ public GarbageCollectorTotal build() {
protected static void setupGarbageCollectorTotalDeserializer(ObjectDeserializer op) {
op.add(Builder::collectionCount, JsonpDeserializer.longDeserializer(), "collection_count");
- op.add(Builder::collectionTime, JsonpDeserializer.stringDeserializer(), "collection_time");
op.add(Builder::collectionTimeInMillis, JsonpDeserializer.longDeserializer(), "collection_time_in_millis");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/IngestTotal.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/IngestTotal.java
index 4dc2054e50..88ba7f108c 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/IngestTotal.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/IngestTotal.java
@@ -59,8 +59,6 @@ public class IngestTotal implements JsonpSerializable {
private final long failed;
- private final List processors;
-
private final long timeInMillis;
// ---------------------------------------------------------------------------------------------
@@ -70,7 +68,6 @@ private IngestTotal(Builder builder) {
this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count");
this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current");
this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed");
- this.processors = ApiTypeHelper.unmodifiableRequired(builder.processors, this, "processors");
this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis");
}
@@ -100,13 +97,6 @@ public final long failed() {
return this.failed;
}
- /**
- * Required - API name: {@code processors}
- */
- public final List processors() {
- return this.processors;
- }
-
/**
* Required - API name: {@code time_in_millis}
*/
@@ -134,16 +124,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("failed");
generator.write(this.failed);
- if (ApiTypeHelper.isDefined(this.processors)) {
- generator.writeKey("processors");
- generator.writeStartArray();
- for (KeyedProcessor item0 : this.processors) {
- item0.serialize(generator, mapper);
-
- }
- generator.writeEnd();
-
- }
generator.writeKey("time_in_millis");
generator.write(this.timeInMillis);
@@ -162,8 +142,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder processors;
-
private Long timeInMillis;
/**
@@ -190,35 +168,6 @@ public final Builder failed(long value) {
return this;
}
- /**
- * Required - API name: {@code processors}
- *
- * Adds all elements of list
to processors
.
- */
- public final Builder processors(List list) {
- this.processors = _listAddAll(this.processors, list);
- return this;
- }
-
- /**
- * Required - API name: {@code processors}
- *
- * Adds one or more values to processors
.
- */
- public final Builder processors(KeyedProcessor value, KeyedProcessor... values) {
- this.processors = _listAdd(this.processors, value, values);
- return this;
- }
-
- /**
- * Required - API name: {@code processors}
- *
- * Adds a value to processors
using a builder lambda.
- */
- public final Builder processors(Function> fn) {
- return processors(fn.apply(new KeyedProcessor.Builder()).build());
- }
-
/**
* Required - API name: {@code time_in_millis}
*/
@@ -253,7 +202,6 @@ protected static void setupIngestTotalDeserializer(ObjectDeserializer op) {
op.add(Builder::mem, MemoryStats._DESERIALIZER, "mem");
op.add(Builder::threads, JvmThreads._DESERIALIZER, "threads");
op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp");
- op.add(Builder::uptime, JsonpDeserializer.stringDeserializer(), "uptime");
op.add(Builder::uptimeInMillis, JsonpDeserializer.longDeserializer(), "uptime_in_millis");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/MemoryStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/MemoryStats.java
index 0251e052c4..4153706bc6 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/MemoryStats.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/MemoryStats.java
@@ -42,7 +42,6 @@
import org.opensearch.client.json.JsonpSerializable;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
-import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
@@ -72,11 +71,14 @@ public class MemoryStats implements JsonpSerializable {
@Nullable
private final Long totalVirtualInBytes;
- private final long totalInBytes;
+ @Nullable
+ private final Long totalInBytes;
- private final long freeInBytes;
+ @Nullable
+ private final Long freeInBytes;
- private final long usedInBytes;
+ @Nullable
+ private final Long usedInBytes;
// ---------------------------------------------------------------------------------------------
@@ -88,9 +90,9 @@ protected MemoryStats(AbstractBuilder> builder) {
this.shareInBytes = builder.shareInBytes;
this.totalVirtual = builder.totalVirtual;
this.totalVirtualInBytes = builder.totalVirtualInBytes;
- this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes");
- this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes");
- this.usedInBytes = ApiTypeHelper.requireNonNull(builder.usedInBytes, this, "usedInBytes");
+ this.totalInBytes = builder.totalInBytes;
+ this.freeInBytes = builder.freeInBytes;
+ this.usedInBytes = builder.usedInBytes;
}
@@ -147,21 +149,21 @@ public final Long totalVirtualInBytes() {
}
/**
- * Required - API name: {@code total_in_bytes}
+ * API name: {@code total_in_bytes}
*/
public final long totalInBytes() {
return this.totalInBytes;
}
/**
- * Required - API name: {@code free_in_bytes}
+ * API name: {@code free_in_bytes}
*/
public final long freeInBytes() {
return this.freeInBytes;
}
/**
- * Required - API name: {@code used_in_bytes}
+ * API name: {@code used_in_bytes}
*/
public final long usedInBytes() {
return this.usedInBytes;
@@ -208,15 +210,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.totalVirtualInBytes);
}
- generator.writeKey("total_in_bytes");
- generator.write(this.totalInBytes);
-
- generator.writeKey("free_in_bytes");
- generator.write(this.freeInBytes);
+
+ if (this.totalInBytes != null) {
+ generator.writeKey("total_in_bytes");
+ generator.write(this.totalInBytes);
+ }
- generator.writeKey("used_in_bytes");
- generator.write(this.usedInBytes);
+ if (this.freeInBytes != null) {
+ generator.writeKey("free_in_bytes");
+ generator.write(this.freeInBytes);
+ }
+ if (this.usedInBytes != null) {
+ generator.writeKey("used_in_bytes");
+ generator.write(this.usedInBytes);
+ }
}
// ---------------------------------------------------------------------------------------------
@@ -320,7 +328,7 @@ public final BuilderT totalVirtualInBytes(@Nullable Long value) {
}
/**
- * Required - API name: {@code total_in_bytes}
+ * API name: {@code total_in_bytes}
*/
public final BuilderT totalInBytes(long value) {
this.totalInBytes = value;
@@ -328,7 +336,7 @@ public final BuilderT totalInBytes(long value) {
}
/**
- * Required - API name: {@code free_in_bytes}
+ * API name: {@code free_in_bytes}
*/
public final BuilderT freeInBytes(long value) {
this.freeInBytes = value;
@@ -336,7 +344,7 @@ public final BuilderT freeInBytes(long value) {
}
/**
- * Required - API name: {@code used_in_bytes}
+ * API name: {@code used_in_bytes}
*/
public final BuilderT usedInBytes(long value) {
this.usedInBytes = value;
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodeBufferPool.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodeBufferPool.java
index 063d48603d..c9998ad65e 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodeBufferPool.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodeBufferPool.java
@@ -55,12 +55,8 @@
public class NodeBufferPool implements JsonpSerializable {
private final long count;
- private final String totalCapacity;
-
private final long totalCapacityInBytes;
- private final String used;
-
private final long usedInBytes;
// ---------------------------------------------------------------------------------------------
@@ -68,10 +64,8 @@ public class NodeBufferPool implements JsonpSerializable {
private NodeBufferPool(Builder builder) {
this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count");
- this.totalCapacity = ApiTypeHelper.requireNonNull(builder.totalCapacity, this, "totalCapacity");
this.totalCapacityInBytes = ApiTypeHelper.requireNonNull(builder.totalCapacityInBytes, this,
"totalCapacityInBytes");
- this.used = ApiTypeHelper.requireNonNull(builder.used, this, "used");
this.usedInBytes = ApiTypeHelper.requireNonNull(builder.usedInBytes, this, "usedInBytes");
}
@@ -87,13 +81,6 @@ public final long count() {
return this.count;
}
- /**
- * Required - API name: {@code total_capacity}
- */
- public final String totalCapacity() {
- return this.totalCapacity;
- }
-
/**
* Required - API name: {@code total_capacity_in_bytes}
*/
@@ -101,13 +88,6 @@ public final long totalCapacityInBytes() {
return this.totalCapacityInBytes;
}
- /**
- * Required - API name: {@code used}
- */
- public final String used() {
- return this.used;
- }
-
/**
* Required - API name: {@code used_in_bytes}
*/
@@ -129,15 +109,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("count");
generator.write(this.count);
- generator.writeKey("total_capacity");
- generator.write(this.totalCapacity);
-
generator.writeKey("total_capacity_in_bytes");
generator.write(this.totalCapacityInBytes);
- generator.writeKey("used");
- generator.write(this.used);
-
generator.writeKey("used_in_bytes");
generator.write(this.usedInBytes);
@@ -152,12 +126,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
private Long count;
- private String totalCapacity;
-
private Long totalCapacityInBytes;
- private String used;
-
private Long usedInBytes;
/**
@@ -168,14 +138,6 @@ public final Builder count(long value) {
return this;
}
- /**
- * Required - API name: {@code total_capacity}
- */
- public final Builder totalCapacity(String value) {
- this.totalCapacity = value;
- return this;
- }
-
/**
* Required - API name: {@code total_capacity_in_bytes}
*/
@@ -184,14 +146,6 @@ public final Builder totalCapacityInBytes(long value) {
return this;
}
- /**
- * Required - API name: {@code used}
- */
- public final Builder used(String value) {
- this.used = value;
- return this;
- }
-
/**
* Required - API name: {@code used_in_bytes}
*/
@@ -224,9 +178,7 @@ public NodeBufferPool build() {
protected static void setupNodeBufferPoolDeserializer(ObjectDeserializer op) {
op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count");
- op.add(Builder::totalCapacity, JsonpDeserializer.stringDeserializer(), "total_capacity");
op.add(Builder::totalCapacityInBytes, JsonpDeserializer.longDeserializer(), "total_capacity_in_bytes");
- op.add(Builder::used, JsonpDeserializer.stringDeserializer(), "used");
op.add(Builder::usedInBytes, JsonpDeserializer.longDeserializer(), "used_in_bytes");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Stats.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Stats.java
index a8bd8255a7..f981d15b5f 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Stats.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Stats.java
@@ -53,6 +53,8 @@
import java.util.Map;
import java.util.function.Function;
+import javax.annotation.Nullable;
+
// typedef: nodes._types.Stats
@JsonpDeserializable
@@ -93,6 +95,7 @@ public class Stats implements JsonpSerializable {
private final String transportAddress;
+ @Nullable
private final Map attributes;
// ---------------------------------------------------------------------------------------------
@@ -118,7 +121,7 @@ private Stats(Builder builder) {
this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp");
this.transport = ApiTypeHelper.requireNonNull(builder.transport, this, "transport");
this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress");
- this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes");
+ this.attributes = builder.attributes;
}
@@ -253,7 +256,7 @@ public final String transportAddress() {
}
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*/
public final Map attributes() {
return this.attributes;
@@ -418,6 +421,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder attributes;
/**
@@ -716,7 +720,7 @@ public final Builder transportAddress(String value) {
}
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*
* Adds all entries of map
to attributes
.
*/
@@ -726,7 +730,7 @@ public final Builder attributes(Map map) {
}
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*
* Adds an entry to attributes
.
*/
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Transport.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Transport.java
index cd9b9ddb10..7488a71ea5 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Transport.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/Transport.java
@@ -55,16 +55,12 @@
public class Transport implements JsonpSerializable {
private final long rxCount;
- private final String rxSize;
-
private final long rxSizeInBytes;
private final int serverOpen;
private final long txCount;
- private final String txSize;
-
private final long txSizeInBytes;
// ---------------------------------------------------------------------------------------------
@@ -72,11 +68,9 @@ public class Transport implements JsonpSerializable {
private Transport(Builder builder) {
this.rxCount = ApiTypeHelper.requireNonNull(builder.rxCount, this, "rxCount");
- this.rxSize = ApiTypeHelper.requireNonNull(builder.rxSize, this, "rxSize");
this.rxSizeInBytes = ApiTypeHelper.requireNonNull(builder.rxSizeInBytes, this, "rxSizeInBytes");
this.serverOpen = ApiTypeHelper.requireNonNull(builder.serverOpen, this, "serverOpen");
this.txCount = ApiTypeHelper.requireNonNull(builder.txCount, this, "txCount");
- this.txSize = ApiTypeHelper.requireNonNull(builder.txSize, this, "txSize");
this.txSizeInBytes = ApiTypeHelper.requireNonNull(builder.txSizeInBytes, this, "txSizeInBytes");
}
@@ -92,13 +86,6 @@ public final long rxCount() {
return this.rxCount;
}
- /**
- * Required - API name: {@code rx_size}
- */
- public final String rxSize() {
- return this.rxSize;
- }
-
/**
* Required - API name: {@code rx_size_in_bytes}
*/
@@ -120,13 +107,6 @@ public final long txCount() {
return this.txCount;
}
- /**
- * Required - API name: {@code tx_size}
- */
- public final String txSize() {
- return this.txSize;
- }
-
/**
* Required - API name: {@code tx_size_in_bytes}
*/
@@ -148,9 +128,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("rx_count");
generator.write(this.rxCount);
- generator.writeKey("rx_size");
- generator.write(this.rxSize);
-
generator.writeKey("rx_size_in_bytes");
generator.write(this.rxSizeInBytes);
@@ -160,9 +137,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("tx_count");
generator.write(this.txCount);
- generator.writeKey("tx_size");
- generator.write(this.txSize);
-
generator.writeKey("tx_size_in_bytes");
generator.write(this.txSizeInBytes);
@@ -177,16 +151,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
private Long rxCount;
- private String rxSize;
-
private Long rxSizeInBytes;
private Integer serverOpen;
private Long txCount;
- private String txSize;
-
private Long txSizeInBytes;
/**
@@ -197,14 +167,6 @@ public final Builder rxCount(long value) {
return this;
}
- /**
- * Required - API name: {@code rx_size}
- */
- public final Builder rxSize(String value) {
- this.rxSize = value;
- return this;
- }
-
/**
* Required - API name: {@code rx_size_in_bytes}
*/
@@ -229,14 +191,6 @@ public final Builder txCount(long value) {
return this;
}
- /**
- * Required - API name: {@code tx_size}
- */
- public final Builder txSize(String value) {
- this.txSize = value;
- return this;
- }
-
/**
* Required - API name: {@code tx_size_in_bytes}
*/
@@ -269,11 +223,9 @@ public Transport build() {
protected static void setupTransportDeserializer(ObjectDeserializer op) {
op.add(Builder::rxCount, JsonpDeserializer.longDeserializer(), "rx_count");
- op.add(Builder::rxSize, JsonpDeserializer.stringDeserializer(), "rx_size");
op.add(Builder::rxSizeInBytes, JsonpDeserializer.longDeserializer(), "rx_size_in_bytes");
op.add(Builder::serverOpen, JsonpDeserializer.integerDeserializer(), "server_open");
op.add(Builder::txCount, JsonpDeserializer.longDeserializer(), "tx_count");
- op.add(Builder::txSize, JsonpDeserializer.stringDeserializer(), "tx_size");
op.add(Builder::txSizeInBytes, JsonpDeserializer.longDeserializer(), "tx_size_in_bytes");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java
index 684b25ea3f..471dd96aaa 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java
@@ -57,9 +57,8 @@
@JsonpDeserializable
public class NodeInfo implements JsonpSerializable {
- private final Map attributes;
-
- private final String buildFlavor;
+ @Nullable
+ private final Map attributes;
private final String buildHash;
@@ -119,8 +118,7 @@ public class NodeInfo implements JsonpSerializable {
private NodeInfo(Builder builder) {
- this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes");
- this.buildFlavor = ApiTypeHelper.requireNonNull(builder.buildFlavor, this, "buildFlavor");
+ this.attributes = ApiTypeHelper.unmodifiable(builder.attributes);
this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash");
this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType");
this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host");
@@ -151,19 +149,13 @@ public static NodeInfo of(Function> fn) {
}
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*/
+ @Nullable
public final Map attributes() {
return this.attributes;
}
- /**
- * Required - API name: {@code build_flavor}
- */
- public final String buildFlavor() {
- return this.buildFlavor;
- }
-
/**
* Required - Short hash of the last git commit in this release.
*
@@ -368,8 +360,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeEnd();
}
- generator.writeKey("build_flavor");
- generator.write(this.buildFlavor);
generator.writeKey("build_hash");
generator.write(this.buildHash);
@@ -503,10 +493,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
+ @Nullable
private Map attributes;
- private String buildFlavor;
-
private String buildHash;
private String buildType;
@@ -566,7 +555,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder aggregations;
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*
* Adds all entries of map
to attributes
.
*/
@@ -576,7 +565,7 @@ public final Builder attributes(Map map) {
}
/**
- * Required - API name: {@code attributes}
+ * API name: {@code attributes}
*
* Adds an entry to attributes
.
*/
@@ -585,14 +574,6 @@ public final Builder attributes(String key, String value) {
return this;
}
- /**
- * Required - API name: {@code build_flavor}
- */
- public final Builder buildFlavor(String value) {
- this.buildFlavor = value;
- return this;
- }
-
/**
* Required - Short hash of the last git commit in this release.
*
@@ -966,7 +947,6 @@ protected static void setupNodeInfoDeserializer(ObjectDeserializer seedHosts;
// ---------------------------------------------------------------------------------------------
private NodeInfoDiscover(Builder builder) {
- this.seedHosts = ApiTypeHelper.requireNonNull(builder.seedHosts, this, "seedHosts");
+ this.seedHosts = builder.seedHosts;
}
@@ -69,8 +74,8 @@ public static NodeInfoDiscover of(Function seedHosts() {
+ return Collections.unmodifiableList(this.seedHosts);
}
/**
@@ -83,10 +88,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
- generator.writeKey("seed_hosts");
- generator.write(this.seedHosts);
-
+ if (this.seedHosts != null) {
+ generator.writeStartArray("seed_hosts");
+ this.seedHosts.forEach(generator::write);
+ generator.writeEnd();
+ }
}
// ---------------------------------------------------------------------------------------------
@@ -96,13 +102,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
- private String seedHosts;
+ @Nullable
+ private List seedHosts;
/**
- * Required - API name: {@code seed_hosts}
+ * API name: {@code seed_hosts}
*/
- public final Builder seedHosts(String value) {
- this.seedHosts = value;
+ public final Builder seedHosts(List values) {
+ this.seedHosts = values;
return this;
}
@@ -129,7 +136,7 @@ public NodeInfoDiscover build() {
protected static void setupNodeInfoDiscoverDeserializer(ObjectDeserializer op) {
- op.add(Builder::seedHosts, JsonpDeserializer.stringDeserializer(), "seed_hosts");
+ op.add(Builder::seedHosts, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "seed_hosts");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoPath.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoPath.java
index 7cab089347..124e47d13b 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoPath.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoPath.java
@@ -58,6 +58,7 @@ public class NodeInfoPath implements JsonpSerializable {
private final String home;
+ @Nullable
private final List repo;
private final List data;
@@ -68,7 +69,7 @@ private NodeInfoPath(Builder builder) {
this.logs = ApiTypeHelper.requireNonNull(builder.logs, this, "logs");
this.home = ApiTypeHelper.requireNonNull(builder.home, this, "home");
- this.repo = ApiTypeHelper.unmodifiableRequired(builder.repo, this, "repo");
+ this.repo = ApiTypeHelper.unmodifiable(builder.repo);
this.data = ApiTypeHelper.unmodifiable(builder.data);
}
@@ -92,7 +93,7 @@ public final String home() {
}
/**
- * Required - API name: {@code repo}
+ * API name: {@code repo}
*/
public final List repo() {
return this.repo;
@@ -178,7 +179,7 @@ public final Builder home(String value) {
}
/**
- * Required - API name: {@code repo}
+ * API name: {@code repo}
*
* Adds all elements of list
to repo
.
*/
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoScript.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoScript.java
index f552e9a009..4cc74372cd 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoScript.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoScript.java
@@ -48,10 +48,13 @@
import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
+import javax.annotation.Nullable;
+
// typedef: nodes.info.NodeInfoScript
@JsonpDeserializable
public class NodeInfoScript implements JsonpSerializable {
+ @Nullable
private final String allowedTypes;
private final String disableMaxCompilationsRate;
@@ -60,7 +63,7 @@ public class NodeInfoScript implements JsonpSerializable {
private NodeInfoScript(Builder builder) {
- this.allowedTypes = ApiTypeHelper.requireNonNull(builder.allowedTypes, this, "allowedTypes");
+ this.allowedTypes = builder.allowedTypes;
this.disableMaxCompilationsRate = ApiTypeHelper.requireNonNull(builder.disableMaxCompilationsRate, this,
"disableMaxCompilationsRate");
@@ -71,8 +74,9 @@ public static NodeInfoScript of(Function>
}
/**
- * Required - API name: {@code allowed_types}
+ * API name: {@code allowed_types}
*/
+ @Nullable
public final String allowedTypes() {
return this.allowedTypes;
}
@@ -94,9 +98,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
- generator.writeKey("allowed_types");
- generator.write(this.allowedTypes);
+ if (this.allowedTypes != null) {
+ generator.writeKey("allowed_types");
+ generator.write(this.allowedTypes);
+ }
generator.writeKey("disable_max_compilations_rate");
generator.write(this.disableMaxCompilationsRate);
@@ -110,12 +115,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
- private String allowedTypes;
+ @Nullable
+ private String allowedTypes;
private String disableMaxCompilationsRate;
/**
- * Required - API name: {@code allowed_types}
+ * API name: {@code allowed_types}
*/
public final Builder allowedTypes(String value) {
this.allowedTypes = value;
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsCluster.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsCluster.java
index db773cd0ad..9b1d17baa2 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsCluster.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsCluster.java
@@ -47,6 +47,8 @@
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
+
+import java.util.List;
import java.util.function.Function;
import javax.annotation.Nullable;
@@ -59,14 +61,15 @@ public class NodeInfoSettingsCluster implements JsonpSerializable {
@Nullable
private final IndexRouting routing;
+ @Nullable
private final NodeInfoSettingsClusterElection election;
@Deprecated
@Nullable
- private final String initialMasterNodes;
+ private final List initialMasterNodes;
@Nullable
- private final String initialClusterManagerNodes;
+ private final List initialClusterManagerNodes;
// ---------------------------------------------------------------------------------------------
@@ -74,7 +77,7 @@ private NodeInfoSettingsCluster(Builder builder) {
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.routing = builder.routing;
- this.election = ApiTypeHelper.requireNonNull(builder.election, this, "election");
+ this.election = builder.election;
this.initialMasterNodes = builder.initialMasterNodes;
this.initialClusterManagerNodes = builder.initialClusterManagerNodes;
@@ -100,8 +103,9 @@ public final IndexRouting routing() {
}
/**
- * Required - API name: {@code election}
+ * API name: {@code election}
*/
+ @Nullable
public final NodeInfoSettingsClusterElection election() {
return this.election;
}
@@ -111,7 +115,7 @@ public final NodeInfoSettingsClusterElection election() {
*/
@Deprecated
@Nullable
- public final String initialMasterNodes() {
+ public final List initialMasterNodes() {
return this.initialMasterNodes;
}
@@ -119,7 +123,7 @@ public final String initialMasterNodes() {
* API name: {@code initial_cluster_manager_nodes}
*/
@Nullable
- public final String initialClusterManagerNodes() {
+ public final List initialClusterManagerNodes() {
return this.initialClusterManagerNodes;
}
@@ -146,15 +150,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.election.serialize(generator, mapper);
if (this.initialMasterNodes != null) {
- generator.writeKey("initial_master_nodes");
- generator.write(this.initialMasterNodes);
-
+ generator.writeStartArray("initial_master_nodes");
+ this.initialMasterNodes.forEach(generator::write);
+ generator.writeEnd();
}
if (this.initialClusterManagerNodes != null) {
- generator.writeKey("initial_cluster_manager_nodes");
- generator.write(this.initialClusterManagerNodes);
-
+ generator.writeStartArray("initial_cluster_manager_nodes");
+ this.initialClusterManagerNodes.forEach(generator::write);
+ generator.writeEnd();
}
}
@@ -171,14 +175,15 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder initialMasterNodes;
@Nullable
- private String initialClusterManagerNodes;
+ private List initialClusterManagerNodes;
/**
* Required - API name: {@code name}
@@ -204,7 +209,7 @@ public final Builder routing(Function> fn) {
@@ -223,7 +228,7 @@ public final Builder election(
* API name: {@code initial_master_nodes}
*/
@Deprecated
- public final Builder initialMasterNodes(@Nullable String value) {
+ public final Builder initialMasterNodes(@Nullable List value) {
this.initialMasterNodes = value;
return this;
}
@@ -231,7 +236,7 @@ public final Builder initialMasterNodes(@Nullable String value) {
/**
* API name: {@code initial_cluster_manager_nodes}
*/
- public final Builder initialClusterManagerNodes(@Nullable String value) {
+ public final Builder initialClusterManagerNodes(@Nullable List value) {
this.initialClusterManagerNodes = value;
return this;
}
@@ -263,8 +268,8 @@ protected static void setupNodeInfoSettingsClusterDeserializer(
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(Builder::routing, IndexRouting._DESERIALIZER, "routing");
op.add(Builder::election, NodeInfoSettingsClusterElection._DESERIALIZER, "election");
- op.add(Builder::initialMasterNodes, JsonpDeserializer.stringDeserializer(), "initial_master_nodes");
- op.add(Builder::initialClusterManagerNodes, JsonpDeserializer.stringDeserializer(), "initial_cluster_manager_nodes");
+ op.add(Builder::initialMasterNodes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "initial_master_nodes");
+ op.add(Builder::initialClusterManagerNodes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "initial_cluster_manager_nodes");
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java
index 92a51be897..bd73a74e9e 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java
+++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java
@@ -57,6 +57,7 @@
public class NodeInfoSettingsNode implements JsonpSerializable {
private final String name;
+ @Nullable
private final Map attr;
@Nullable
@@ -67,7 +68,7 @@ public class NodeInfoSettingsNode implements JsonpSerializable {
private NodeInfoSettingsNode(Builder builder) {
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
- this.attr = ApiTypeHelper.unmodifiableRequired(builder.attr, this, "attr");
+ this.attr = ApiTypeHelper.unmodifiable(builder.attr);
this.maxLocalStorageNodes = builder.maxLocalStorageNodes;
}
@@ -84,8 +85,9 @@ public final String name() {
}
/**
- * Required - API name: {@code attr}
+ * API name: {@code attr}
*/
+ @Nullable
public final Map attr() {
return this.attr;
}
@@ -140,6 +142,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
private String name;
+ @Nullable
private Map attr;
@Nullable
@@ -164,7 +167,7 @@ public final Builder attr(Map map) {
}
/**
- * Required - API name: {@code attr}
+ * API name: {@code attr}
*
* Adds an entry to attr
.
*/
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/ClusterClientIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/ClusterClientIT.java
index 7ad19ec4ba..8b21eadba8 100644
--- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/ClusterClientIT.java
+++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/ClusterClientIT.java
@@ -34,10 +34,10 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
-public class ClusterClientIT extends OpenSearchRestHighLevelClientTestCase {
+public class ClusterClientIT extends OpenSearchJavaClientTestCase {
public void testClusterPutSettings() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
final String transientSettingKey = RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey();
String[] transientSettingKeySplit = transientSettingKey.split("\\.");
@@ -80,7 +80,7 @@ public void testClusterPutSettings() throws IOException {
}
public void testClusterUpdateSettingNonExistent() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
String setting = "no_idea_what_you_are_talking_about";
int value = 10;
@@ -105,7 +105,7 @@ public void testClusterUpdateSettingNonExistent() throws IOException {
}
public void testClusterGetSettings() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
final String transientSettingKey = RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey();
final String transientSettingValue = "10b";
@@ -140,7 +140,7 @@ public void testClusterGetSettings() throws IOException {
}
public void testClusterGetSettingsWithDefault() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
final String transientSettingKey = RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey();
final String transientSettingValue = "10b";
@@ -175,7 +175,7 @@ public void testClusterGetSettingsWithDefault() throws IOException {
}
public void testClusterHealthYellowClusterLevel() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
createIndex("index", Settings.EMPTY);
createIndex("index2", Settings.EMPTY);
HealthRequest request = new HealthRequest.Builder().timeout(t->t.time("5s")).build();
@@ -184,7 +184,7 @@ public void testClusterHealthYellowClusterLevel() throws IOException {
}
public void testClusterHealthYellowIndicesLevel() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
String firstIndex = "index";
String secondIndex = "index2";
// including another index that we do not assert on, to ensure that we are not
@@ -222,7 +222,7 @@ private static void assertYellowShards(HealthResponse response) {
}
public void testClusterHealthYellowSpecificIndex() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
createIndex("index", Settings.EMPTY);
createIndex("index2", Settings.EMPTY);
HealthRequest request = new HealthRequest.Builder()
@@ -287,7 +287,7 @@ private static void assertNoIndices(HealthResponse response) {
}
public void testClusterHealthNotFoundIndex() throws IOException {
- OpenSearchClient openSearchClient = highLevelClient();
+ OpenSearchClient openSearchClient = javaClient();
createIndex("index", Settings.EMPTY);
HealthRequest request = new HealthRequest.Builder()
.index("notexisted-index")
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java
index 1fee8b7a77..5a31ca2e92 100644
--- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java
+++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java
@@ -36,17 +36,17 @@
import java.util.Collections;
import java.util.List;
-public class CrudIT extends OpenSearchRestHighLevelClientTestCase {
+public class CrudIT extends OpenSearchJavaClientTestCase {
public void testDelete() throws IOException {
{
// Testing index deletion
String index1 = "my-index";
- CreateIndexResponse createIndexResponse = highLevelClient().indices().create(b -> b.index(index1));
+ CreateIndexResponse createIndexResponse = javaClient().indices().create(b -> b.index(index1));
assertEquals(index1, createIndexResponse.index());
assertTrue(createIndexResponse.acknowledged());
assertTrue(createIndexResponse.shardsAcknowledged());
- DeleteIndexResponse deleteIndexResponse = highLevelClient().indices().delete(b -> b.index(index1));
+ DeleteIndexResponse deleteIndexResponse = javaClient().indices().delete(b -> b.index(index1));
assertTrue(deleteIndexResponse.acknowledged());
}
@@ -54,22 +54,22 @@ public void testDelete() throws IOException {
// Testing doc deletion after data ingestion
String docId = "id";
String index = "my-index1";
- highLevelClient().indices().create(b -> b.index(index));
+ javaClient().indices().create(b -> b.index(index));
- String id = highLevelClient().index(b -> b
+ String id = javaClient().index(b -> b
.index(index)
.id(docId)
.document(Collections.singletonMap("foo", "bar")))
.id();
assertEquals(id, docId);
- DeleteResponse deleteResponse = highLevelClient().delete(d -> d.id(docId).index(index));
+ DeleteResponse deleteResponse = javaClient().delete(d -> d.id(docId).index(index));
assertEquals(deleteResponse.index(), index);
assertEquals(deleteResponse.id(), docId);
assertEquals(deleteResponse.result(), Result.Deleted);
String docIdTemp = "does_not_exist";
- DeleteResponse deleteResponseDocNotExist = highLevelClient().delete(d -> d.id(docIdTemp).index(index));
+ DeleteResponse deleteResponseDocNotExist = javaClient().delete(d -> d.id(docIdTemp).index(index));
assertEquals(deleteResponseDocNotExist.index(), index);
assertEquals(deleteResponseDocNotExist.id(), docIdTemp);
assertEquals(deleteResponseDocNotExist.result(), Result.NotFound);
@@ -78,26 +78,26 @@ public void testDelete() throws IOException {
}
public void testExists() throws IOException {
- assertFalse(highLevelClient().indices().exists(b -> b.index("index")).value());
+ assertFalse(javaClient().indices().exists(b -> b.index("index")).value());
String index = "ingest-test";
// Create an index
- CreateIndexResponse createIndexResponse = highLevelClient().indices().create(b -> b
+ CreateIndexResponse createIndexResponse = javaClient().indices().create(b -> b
.index(index)
);
assertEquals(index, createIndexResponse.index());
// Check that it actually exists. Example of a boolean response
- assertTrue(highLevelClient().indices().exists(b -> b.index(index)).value());
+ assertTrue(javaClient().indices().exists(b -> b.index(index)).value());
- highLevelClient().index(b -> b
+ javaClient().index(b -> b
.index(index)
.id("id")
.document(Collections.singletonMap("foo", "bar"))
.refresh(Refresh.True));
- assertTrue(highLevelClient().exists(b -> b.index(index).id("id")).value());
- assertFalse(highLevelClient().exists(b -> b.index(index).id("random_id")).value());
- assertFalse(highLevelClient().exists(b -> b.index(index).id("random_id").version(1L)).value());
+ assertTrue(javaClient().exists(b -> b.index(index).id("id")).value());
+ assertFalse(javaClient().exists(b -> b.index(index).id("random_id")).value());
+ assertFalse(javaClient().exists(b -> b.index(index).id("random_id").version(1L)).value());
}
public void testSourceExists() throws IOException {
@@ -110,10 +110,10 @@ public void testSourceExists() throws IOException {
.index("index")
.id("id")
.build();
- BooleanResponse response = highLevelClient().existsSource(request);
+ BooleanResponse response = javaClient().existsSource(request);
assertFalse(response.value());
}
- highLevelClient().index(b -> b
+ javaClient().index(b -> b
.index("index")
.id("id")
.refresh(Refresh.True)
@@ -123,7 +123,7 @@ public void testSourceExists() throws IOException {
.index("index")
.id("id")
.build();
- BooleanResponse response = highLevelClient().existsSource(request);
+ BooleanResponse response = javaClient().existsSource(request);
assertTrue(response.value());
}
{
@@ -131,7 +131,7 @@ public void testSourceExists() throws IOException {
.index("index")
.id("does_not_exist")
.build();
- BooleanResponse response = highLevelClient().existsSource(request);
+ BooleanResponse response = javaClient().existsSource(request);
assertFalse(response.value());
}
}
@@ -141,7 +141,7 @@ public void testGet() throws IOException {
{
OpenSearchException exception = expectThrows(
OpenSearchException.class,
- () -> highLevelClient().get(new GetRequest.Builder().index("index").id("id").build(), String.class)
+ () -> javaClient().get(new GetRequest.Builder().index("index").id("id").build(), String.class)
);
assertEquals(404, exception.status());
assertEquals("Request failed: [index_not_found_exception] no such index [index]",
@@ -152,10 +152,10 @@ public void testGet() throws IOException {
appData.setIntValue(1337);
appData.setMsg("foo");
- highLevelClient().index(b -> b.index("index").id("id").document(appData).refresh(Refresh.True));
+ javaClient().index(b -> b.index("index").id("id").document(appData).refresh(Refresh.True));
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index")
.id("id")
.version(1L)
@@ -169,7 +169,7 @@ public void testGet() throws IOException {
assertEquals(appData.getMsg(), getResponse.source().getMsg());
}
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index")
.id("does_not_exist")
, AppData.class
@@ -187,13 +187,13 @@ public void testGetWithTypes() throws IOException {
appData.setIntValue(1337);
appData.setMsg("foo");
- highLevelClient().index(b -> b
+ javaClient().index(b -> b
.index("index")
.id("id")
.document(appData)
.refresh(Refresh.True));
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index")
.id("id")
, AppData.class
@@ -216,7 +216,7 @@ public void testMultiGet() throws IOException {
List ids = new ArrayList<>();
ids.add("id1");
ids.add("id2");
- MgetResponse response = highLevelClient().mget(b -> b
+ MgetResponse response = javaClient().mget(b -> b
.index("index")
.ids(ids)
, AppData.class
@@ -256,7 +256,7 @@ public void testUpdate() throws Exception {
.doc(appData)
.build();
try {
- highLevelClient().update(updateRequest, AppData.class);
+ javaClient().update(updateRequest, AppData.class);
} catch (OpenSearchException e) {
// 1.x: [document_missing_exception] [_doc][does_not_exist]: document missing
// 2.x: [document_missing_exception] [does_not_exist]: document missing
@@ -271,7 +271,7 @@ public void testUpdate() throws Exception {
.id("id")
.document(appData)
.build();
- IndexResponse indexResponse = highLevelClient().index(indexRequest);
+ IndexResponse indexResponse = javaClient().index(indexRequest);
assertEquals(Result.Created, indexResponse.result());
long lastUpdateSeqNo;
@@ -282,7 +282,7 @@ public void testUpdate() throws Exception {
.id("id")
.doc(updatedAppData)
.build();
- UpdateResponse updateResponse = highLevelClient().update(updateRequest, AppData.class);
+ UpdateResponse updateResponse = javaClient().update(updateRequest, AppData.class);
assertEquals(Result.Updated, updateResponse.result());
assertEquals(indexResponse.version() + 1, updateResponse.version());
lastUpdateSeqNo = updateResponse.seqNo();
@@ -309,14 +309,14 @@ public void testUpdateWithTypes() throws IOException {
.id("id")
.document(appData)
.build();
- IndexResponse indexResponse = highLevelClient().index(indexRequest);
+ IndexResponse indexResponse = javaClient().index(indexRequest);
UpdateRequest updateRequest = new UpdateRequest.Builder()
.index("index")
.id("id")
.doc(updatedAppData)
.build();
- UpdateResponse updateResponse = highLevelClient().update(updateRequest, AppData.class);
+ UpdateResponse updateResponse = javaClient().update(updateRequest, AppData.class);
assertEquals(Result.Updated, updateResponse.result());
assertEquals(indexResponse.version() + 1, updateResponse.version());
@@ -341,7 +341,7 @@ public void testBulk() throws IOException {
if (!erroneous) {
assertEquals(
Result.Created,
- highLevelClient().index(b -> b.index("index").id(id).document(appData)).result()
+ javaClient().index(b -> b.index("index").id(id).document(appData)).result()
);
}
BulkOperation op = new BulkOperation.Builder().delete(d -> d.index("index").id(id)).build();
@@ -367,7 +367,7 @@ public void testBulk() throws IOException {
opsList.add(op);
if (erroneous) {
- assertEquals(Result.Created, highLevelClient().index(b -> b.
+ assertEquals(Result.Created, javaClient().index(b -> b.
index("index").id(id).document(appData)).result());
}
@@ -381,7 +381,7 @@ public void testBulk() throws IOException {
if (!erroneous) {
assertEquals(
Result.Created,
- highLevelClient().index(b -> b.index("index").id(id).document(appData)).result()
+ javaClient().index(b -> b.index("index").id(id).document(appData)).result()
);
}
}
@@ -389,7 +389,7 @@ public void testBulk() throws IOException {
}
BulkRequest bulkRequest = new BulkRequest.Builder().operations(opsList).build();
- BulkResponse bulkResponse = highLevelClient().bulk(bulkRequest);
+ BulkResponse bulkResponse = javaClient().bulk(bulkRequest);
assertTrue(bulkResponse.took() > 0);
assertEquals(nbItems, bulkResponse.items().size());
@@ -424,12 +424,12 @@ public void testUrlEncode() throws IOException {
appData.setIntValue(1337);
appData.setMsg("foo");
{
- IndexResponse response = highLevelClient().index(b -> b.index(indexPattern).id("id#1").document(appData));
+ IndexResponse response = javaClient().index(b -> b.index(indexPattern).id("id#1").document(appData));
assertEquals(expectedIndex, response.index());
assertEquals("id#1", response.id());
}
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index(indexPattern).id("id#1"), AppData.class);
assertTrue(getResponse.found());
assertEquals(expectedIndex, getResponse.index());
@@ -438,19 +438,19 @@ public void testUrlEncode() throws IOException {
String docId = "this/is/the/id";
{
- IndexResponse indexResponse = highLevelClient().index(b -> b.index("index").id(docId).document(appData));
+ IndexResponse indexResponse = javaClient().index(b -> b.index("index").id(docId).document(appData));
assertEquals("index", indexResponse.index());
assertEquals(docId, indexResponse.id());
}
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index").id(docId), AppData.class);
assertTrue(getResponse.found());
assertEquals("index", getResponse.index());
assertEquals(docId, getResponse.id());
}
- assertTrue(highLevelClient().indices().exists(b -> b.index(indexPattern, "index")).value());
+ assertTrue(javaClient().indices().exists(b -> b.index(indexPattern, "index")).value());
}
public void testParamsEncode() throws IOException {
@@ -460,12 +460,12 @@ public void testParamsEncode() throws IOException {
AppData appData = new AppData();
appData.setIntValue(1337);
appData.setMsg("foo");
- IndexResponse response = highLevelClient().index(b -> b.index("index").id(id).document(appData).routing(routing));
+ IndexResponse response = javaClient().index(b -> b.index("index").id(id).document(appData).routing(routing));
assertEquals("index", response.index());
assertEquals(id, response.id());
}
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index").id("id").routing(routing), AppData.class);
assertTrue(getResponse.found());
assertEquals("index", getResponse.index());
@@ -481,13 +481,13 @@ public void testGetIdWithPlusSign() throws Exception {
appData.setMsg("foo");
{
- IndexResponse indexResponse = highLevelClient().index(b -> b
+ IndexResponse indexResponse = javaClient().index(b -> b
.index("index").id(id).document(appData));
assertEquals("index", indexResponse.index());
assertEquals(id, indexResponse.id());
}
{
- GetResponse getResponse = highLevelClient().get(b -> b
+ GetResponse getResponse = javaClient().get(b -> b
.index("index").id(id), AppData.class);
assertTrue(getResponse.found());
assertEquals("index", getResponse.index());
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/IndicesClientIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/IndicesClientIT.java
index 89c17043e4..38726a57a5 100644
--- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/IndicesClientIT.java
+++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/IndicesClientIT.java
@@ -17,23 +17,22 @@
import org.opensearch.client.opensearch.indices.IndexState;
import org.opensearch.common.settings.Settings;
-
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
-public class IndicesClientIT extends OpenSearchRestHighLevelClientTestCase {
+public class IndicesClientIT extends OpenSearchJavaClientTestCase {
public void testIndicesExists() throws IOException {
// Index present
{
String indexName = "test_index_exists_index_present";
- highLevelClient().indices().create(_1 -> _1.index(indexName));
+ javaClient().indices().create(_1 -> _1.index(indexName));
GetIndexRequest request = new GetIndexRequest.Builder().index(indexName).build();
- GetIndexResponse response = highLevelClient().indices().get(request);
+ GetIndexResponse response = javaClient().indices().get(request);
assertNotNull(response.result());
assertEquals(response.result().size(), 1);
@@ -45,7 +44,7 @@ public void testIndicesExists() throws IOException {
GetIndexRequest request = new GetIndexRequest.Builder().index(indexName).build();
try {
- highLevelClient().indices().get(request);
+ javaClient().indices().get(request);
fail(); // should never execute
} catch (OpenSearchException ex) {
assertNotNull(ex);
@@ -66,7 +65,7 @@ public void testIndicesExists() throws IOException {
GetIndexRequest request = new GetIndexRequest.Builder().index(existingIndex, nonExistentIndex).build();
try {
- highLevelClient().indices().get(request);
+ javaClient().indices().get(request);
fail(); // should never execute
} catch (OpenSearchException ex) {
assertNotNull(ex);
@@ -75,8 +74,8 @@ public void testIndicesExists() throws IOException {
}
public void testCreateIndex() throws Exception {
- OpenSearchAsyncClient asyncClient = new OpenSearchAsyncClient(highLevelClient()._transport());
- CreateIndexResponse createResponse = highLevelClient().indices().create(b -> b.index("my-index"));
+ OpenSearchAsyncClient asyncClient = new OpenSearchAsyncClient(javaClient()._transport());
+ CreateIndexResponse createResponse = javaClient().indices().create(b -> b.index("my-index"));
assertTrue(createResponse.acknowledged());
assertTrue(createResponse.shardsAcknowledged());
@@ -98,7 +97,7 @@ public void testGetSettingsNonExistentIndex() throws IOException {
.index(nonExistentIndex).build();
try {
- highLevelClient().indices().getSettings(getIndicesSettingsRequest);
+ javaClient().indices().getSettings(getIndicesSettingsRequest);
fail();
} catch (OpenSearchException ex) {
assertNotNull(ex);
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/NodesIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/NodesIT.java
new file mode 100644
index 0000000000..74fc61a3ec
--- /dev/null
+++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/NodesIT.java
@@ -0,0 +1,25 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * The OpenSearch Contributors require contributions made to
+ * this file be licensed under the Apache-2.0 license or a
+ * compatible open source license.
+ */
+
+package org.opensearch.client.opensearch.integTest;
+
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.Matchers.anEmptyMap;
+
+import java.io.IOException;
+
+import org.opensearch.client.opensearch.nodes.NodesStatsResponse;
+
+public class NodesIT extends OpenSearchJavaClientTestCase {
+ public void testNodesStats() throws IOException {
+ final NodesStatsResponse response = javaClient().nodes().stats();
+ assertThat(response.clusterName(), not(nullValue()));
+ assertThat(response.nodes(), not(anEmptyMap()));
+ }
+}
\ No newline at end of file
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java
new file mode 100644
index 0000000000..b7c4bdb4f6
--- /dev/null
+++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java
@@ -0,0 +1,200 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * The OpenSearch Contributors require contributions made to
+ * this file be licensed under the Apache-2.0 license or a
+ * compatible open source license.
+ */
+
+package org.opensearch.client.opensearch.integTest;
+
+import org.apache.hc.client5.http.auth.AuthScope;
+import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
+import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
+import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
+import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder;
+import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder;
+import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
+import org.apache.hc.core5.function.Factory;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
+import org.apache.hc.core5.reactor.ssl.TlsDetails;
+import org.apache.hc.core5.ssl.SSLContextBuilder;
+import org.opensearch.Version;
+import org.opensearch.client.RestClient;
+import org.opensearch.client.RestClientBuilder;
+import org.opensearch.client.json.jackson.JacksonJsonpMapper;
+import org.opensearch.client.opensearch.OpenSearchClient;
+import org.opensearch.client.opensearch._types.ExpandWildcard;
+import org.opensearch.client.opensearch.cat.IndicesResponse;
+import org.opensearch.client.opensearch.cat.indices.IndicesRecord;
+import org.opensearch.client.opensearch.indices.DeleteIndexRequest;
+import org.opensearch.client.opensearch.nodes.NodesInfoResponse;
+import org.opensearch.client.opensearch.nodes.info.NodeInfo;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.opensearch.client.transport.rest_client.RestClientTransport;
+import org.opensearch.common.settings.Settings;
+import org.opensearch.core.internal.io.IOUtils;
+import org.opensearch.test.rest.OpenSearchRestTestCase;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.TreeSet;
+
+import javax.net.ssl.SSLEngine;
+
+public abstract class OpenSearchJavaClientTestCase extends OpenSearchRestTestCase {
+ private static OpenSearchClient javaClient;
+ private static OpenSearchClient adminJavaClient;
+
+ private static TreeSet nodeVersions;
+ private static List clusterHosts;
+
+ @Before
+ public void initJavaClient() throws IOException {
+ if (javaClient == null) {
+ String cluster = getTestRestCluster();
+ String[] stringUrls = cluster.split(",");
+ List hosts = new ArrayList<>(stringUrls.length);
+ for (String stringUrl : stringUrls) {
+ int portSeparator = stringUrl.lastIndexOf(':');
+ if (portSeparator < 0) {
+ throw new IllegalArgumentException("Illegal cluster url [" + stringUrl + "]");
+ }
+ String host = stringUrl.substring(0, portSeparator);
+ int port = Integer.valueOf(stringUrl.substring(portSeparator + 1));
+ hosts.add(new HttpHost(getProtocol(), host, port));
+ }
+ clusterHosts = Collections.unmodifiableList(hosts);
+ logger.info("initializing REST clients against {}", clusterHosts);
+
+ javaClient = buildJavaClient(restClientSettings(), clusterHosts.toArray(new HttpHost[clusterHosts.size()]));
+ adminJavaClient = buildJavaClient(restAdminSettings(), clusterHosts.toArray(new HttpHost[clusterHosts.size()]));
+
+ nodeVersions = new TreeSet<>();
+ final NodesInfoResponse response = adminJavaClient.nodes().info();
+ for (final NodeInfo node : response.nodes().values()) {
+ nodeVersions.add(Version.fromString(node.version()));
+ }
+ }
+ }
+
+ private boolean isHttps() {
+ return Optional.ofNullable(System.getProperty("https"))
+ .map("true"::equalsIgnoreCase)
+ .orElse(false);
+ }
+
+ @Override
+ protected String getProtocol() {
+ return isHttps() ? "https" : "http";
+ }
+
+ protected OpenSearchClient buildJavaClient(Settings settings, HttpHost[] hosts) throws IOException {
+ return new OpenSearchClient(new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper()));
+ }
+
+ @Override
+ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOException {
+ RestClientBuilder builder = RestClient.builder(hosts);
+
+ if (isHttps()) {
+ builder.setHttpClientConfigCallback(httpClientBuilder -> {
+ String userName = Optional.ofNullable(System.getProperty("user")).orElse("admin");
+ String password = Optional.ofNullable(System.getProperty("password")).orElse("admin");
+
+ final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+ for (final HttpHost host: hosts) {
+ credentialsProvider.setCredentials(new AuthScope(host),
+ new UsernamePasswordCredentials(userName, password.toCharArray()));
+ }
+
+ try {
+ final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder
+ .create()
+ .setSslContext(SSLContextBuilder.create().loadTrustMaterial(null, (chains, authType) -> true).build())
+ // disable the certificate since our testing cluster just uses the default security configuration
+ .setHostnameVerifier(NoopHostnameVerifier.INSTANCE)
+ // See please https://issues.apache.org/jira/browse/HTTPCLIENT-2219
+ .setTlsDetailsFactory(new Factory() {
+ @Override
+ public TlsDetails create(final SSLEngine sslEngine) {
+ return new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol());
+ }
+ })
+ .build();
+
+ final PoolingAsyncClientConnectionManager connectionManager = PoolingAsyncClientConnectionManagerBuilder.create()
+ .setTlsStrategy(tlsStrategy)
+ .build();
+
+ return httpClientBuilder
+ .setDefaultCredentialsProvider(credentialsProvider)
+ .setConnectionManager(connectionManager);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
+ builder.setStrictDeprecationMode(true);
+ return builder.build();
+ }
+
+ protected static OpenSearchClient javaClient() {
+ return javaClient;
+ }
+
+ protected static OpenSearchClient adminJavaClient() {
+ return adminJavaClient;
+ }
+
+ protected String getTestRestCluster() {
+ String cluster = System.getProperty("tests.rest.cluster");
+ if (cluster == null) {
+ cluster = "localhost:9200";
+ }
+ return cluster;
+ }
+
+ @After
+ protected void wipeAllOSIndices() throws IOException {
+ final IndicesResponse response = adminJavaClient()
+ .cat()
+ .indices(r -> r.expandWildcards(ExpandWildcard.All));
+
+ for (IndicesRecord index : response.valueBody()) {
+ if (index.index() != null && !".opendistro_security".equals(index.index())) {
+ adminJavaClient().indices().delete(new DeleteIndexRequest.Builder().index(index.index()).build());
+ }
+ }
+ }
+
+ @AfterClass
+ public static void cleanupJavaClient() throws IOException {
+ try {
+ if (javaClient != null) {
+ IOUtils.close(javaClient._transport());
+ }
+
+ if (adminJavaClient != null) {
+ IOUtils.close(adminJavaClient._transport());
+ }
+ } finally {
+ clusterHosts = null;
+ javaClient = null;
+ adminJavaClient = null;
+ nodeVersions = null;
+ }
+ }
+
+ @Override
+ protected boolean preserveIndicesUponCompletion() {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchRestHighLevelClientTestCase.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchRestHighLevelClientTestCase.java
deleted file mode 100644
index d1e093952f..0000000000
--- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchRestHighLevelClientTestCase.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- */
-
-package org.opensearch.client.opensearch.integTest;
-
-
-import org.apache.hc.client5.http.auth.AuthScope;
-import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
-import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
-import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder;
-import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder;
-import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
-import org.apache.hc.core5.function.Factory;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
-import org.apache.hc.core5.reactor.ssl.TlsDetails;
-import org.apache.hc.core5.ssl.SSLContextBuilder;
-import org.junit.After;
-import org.opensearch.client.Request;
-import org.opensearch.client.Response;
-import org.opensearch.client.RestClient;
-import org.opensearch.client.RestClientBuilder;
-import org.opensearch.client.json.jackson.JacksonJsonpMapper;
-import org.opensearch.client.opensearch.OpenSearchClient;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.opensearch.client.transport.OpenSearchTransport;
-import org.opensearch.client.transport.rest_client.RestClientTransport;
-import org.opensearch.common.settings.Settings;
-import org.opensearch.common.xcontent.DeprecationHandler;
-import org.opensearch.common.xcontent.NamedXContentRegistry;
-import org.opensearch.common.xcontent.XContentParser;
-import org.opensearch.common.xcontent.XContentType;
-import org.opensearch.test.rest.OpenSearchRestTestCase;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import javax.net.ssl.SSLEngine;
-
-public abstract class OpenSearchRestHighLevelClientTestCase extends OpenSearchRestTestCase {
-
- private static RestClient restClient;
- private static OpenSearchClient restHighLevelClient;
-
- @Before
- public void initHighLevelClient() throws IOException {
- super.initClient();
- if (restHighLevelClient == null) {
- // Create the low-level client
- restClient = client();
- // Create the transport that provides JSON and http services to API clients
- OpenSearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
- // Create API client
- restHighLevelClient = new OpenSearchClient(transport);
- }
- }
-
- private boolean isHttps() {
- return Optional.ofNullable(System.getProperty("https"))
- .map("true"::equalsIgnoreCase)
- .orElse(false);
- }
-
- @Override
- protected String getProtocol() {
- return isHttps() ? "https" : "http";
- }
-
- protected static OpenSearchClient highLevelClient() {
- return restHighLevelClient;
- }
-
- @Override
- protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOException {
- RestClientBuilder builder = RestClient.builder(hosts);
- builder.setStrictDeprecationMode(true);
- if (isHttps()) {
- configureHttpsClient(builder, hosts);
- }
- return builder.build();
- }
-
- private void configureHttpsClient(RestClientBuilder builder, HttpHost[] hosts) {
- builder.setHttpClientConfigCallback(httpClientBuilder -> {
- String userName = Optional.ofNullable(System.getProperty("user")).orElse("admin");
- String password = Optional.ofNullable(System.getProperty("password")).orElse("admin");
-
- final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
- for (final HttpHost host: hosts) {
- credentialsProvider.setCredentials(new AuthScope(host), new UsernamePasswordCredentials(userName, password.toCharArray()));
- }
-
- try {
- final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder
- .create()
- .setSslContext(SSLContextBuilder.create().loadTrustMaterial(null, (chains, authType) -> true).build())
- // disable the certificate since our testing cluster just uses the default security configuration
- .setHostnameVerifier(NoopHostnameVerifier.INSTANCE)
- // See please https://issues.apache.org/jira/browse/HTTPCLIENT-2219
- .setTlsDetailsFactory(new Factory() {
- @Override
- public TlsDetails create(final SSLEngine sslEngine) {
- return new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol());
- }
- })
- .build();
-
- final PoolingAsyncClientConnectionManager connectionManager = PoolingAsyncClientConnectionManagerBuilder.create()
- .setTlsStrategy(tlsStrategy)
- .build();
-
- return httpClientBuilder
- .setDefaultCredentialsProvider(credentialsProvider)
- .setConnectionManager(connectionManager);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- });
- }
-
- @Override
- protected String getTestRestCluster() {
- String cluster = System.getProperty("tests.rest.cluster");
- if (cluster == null) {
- cluster = "localhost:9200";
- }
- return cluster;
- }
-
- @AfterClass
- public static void cleanupClient() throws IOException {
- try {
- restClient.close();
- } finally {
- restClient = null;
- restHighLevelClient = null;
- }
- }
-
- @SuppressWarnings("unchecked")
- @After
- protected void wipeAllOSIndices() throws IOException {
- Response response = adminClient().performRequest(new Request("GET", "/_cat/indices?format=json&expand_wildcards=all"));
- XContentType xContentType = XContentType.fromMediaType(response.getEntity().getContentType());
- XContentParser parser = xContentType.xContent().createParser(
- NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
- response.getEntity().getContent());
-
- try {
- XContentParser.Token token = parser.nextToken();
- List