diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index ece87b3eed38a..89e81c64fe205 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -9,4 +9,4 @@
-
\ No newline at end of file
+
diff --git a/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java b/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java
index 5a70782632ae7..248673d11797a 100644
--- a/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java
+++ b/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java
@@ -31,8 +31,10 @@
*/
package org.opensearch;
+import org.opensearch.common.CheckedFunction;
import org.opensearch.common.Nullable;
import org.opensearch.core.common.Strings;
+import org.opensearch.core.common.io.stream.BaseStreamInput;
import org.opensearch.core.common.logging.LoggerMessageFormat;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.ToXContentFragment;
@@ -41,10 +43,12 @@
import java.io.IOException;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import static java.util.Collections.singletonMap;
@@ -434,4 +438,98 @@ private String getShardIdString() {
}
return null;
}
+
+ /**
+ * An ExceptionHandle for registering Exceptions that can be serialized over the transport wire
+ *
+ * @opensearch.internal
+ */
+ protected static abstract class BaseOpenSearchExceptionHandle {
+ final Class extends BaseOpenSearchException> exceptionClass;
+ final CheckedFunction extends BaseStreamInput, ? extends BaseOpenSearchException, IOException> constructor;
+ final int id;
+ final Version versionAdded;
+
+ BaseOpenSearchExceptionHandle(
+ Class exceptionClass,
+ CheckedFunction constructor,
+ int id,
+ Version versionAdded
+ ) {
+ // We need the exceptionClass because you can't dig it out of the constructor reliably.
+ this.exceptionClass = exceptionClass;
+ this.constructor = constructor;
+ this.versionAdded = versionAdded;
+ this.id = id;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static BaseOpenSearchException readException(T input, int id) throws IOException {
+ CheckedFunction opensearchException = (CheckedFunction<
+ T,
+ ? extends BaseOpenSearchException,
+ IOException>) OpenSearchExceptionHandleRegistry.getSupplier(id);
+ if (opensearchException == null) {
+ throw new IllegalStateException("unknown exception for id: " + id);
+ }
+ return opensearchException.apply(input);
+ }
+
+ /**
+ * Registry of ExceptionHandlers
+ *
+ * @opensearch.internal
+ */
+ public static class OpenSearchExceptionHandleRegistry {
+ /** Registry mapping from unique Ordinal to the Exception Constructor */
+ private static final Map<
+ Integer,
+ CheckedFunction extends BaseStreamInput, ? extends BaseOpenSearchException, IOException>> ID_TO_SUPPLIER_REGISTRY =
+ new ConcurrentHashMap<>();
+ /** Registry mapping from Exception class to the Exception Handler */
+ private static final Map<
+ Class extends BaseOpenSearchException>,
+ BaseOpenSearchExceptionHandle> CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY = new ConcurrentHashMap<>();
+
+ /** returns the Exception constructor function from a given ordinal */
+ public static CheckedFunction extends BaseStreamInput, ? extends BaseOpenSearchException, IOException> getSupplier(final int id) {
+ return ID_TO_SUPPLIER_REGISTRY.get(id);
+ }
+
+ /** registers the Exception handler */
+ public static void registerExceptionHandle(final BaseOpenSearchExceptionHandle handle) {
+ ID_TO_SUPPLIER_REGISTRY.put(handle.id, handle.constructor);
+ CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.put(handle.exceptionClass, handle);
+ }
+
+ /** Gets the unique ordinal id of the Exception from the given class */
+ public static int getId(final Class extends BaseOpenSearchException> exception) {
+ return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.get(exception).id;
+ }
+
+ /** returns a set of ids */
+ public static Set ids() {
+ return ID_TO_SUPPLIER_REGISTRY.keySet();
+ }
+
+ /** returns a collection of handles */
+ public static Collection handles() {
+ return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.values();
+ }
+
+ /** checks that the exception class is registered */
+ public static boolean isRegistered(final Class extends Throwable> exception, final Version version) {
+ BaseOpenSearchExceptionHandle openSearchExceptionHandle = CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.get(exception);
+ if (openSearchExceptionHandle != null) {
+ return version.onOrAfter(openSearchExceptionHandle.versionAdded);
+ }
+ return false;
+ }
+
+ /** returns a set of registered exception classes */
+ public static Set> getRegisteredKeys() { // for testing
+ return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE_REGISTRY.keySet();
+ }
+ }
}
diff --git a/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamInput.java b/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamInput.java
index a0e50722bf01d..178333d529cf6 100644
--- a/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamInput.java
+++ b/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamInput.java
@@ -7,7 +7,17 @@
*/
package org.opensearch.core.common.io.stream;
+import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.CharsRef;
+import org.opensearch.Version;
+import org.opensearch.common.Nullable;
+
+import java.io.EOFException;
+import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.function.IntFunction;
/**
* Foundation class for reading core types off the transport stream
@@ -16,4 +26,316 @@
*
* @opensearch.internal
*/
-public abstract class BaseStreamInput extends InputStream {}
+public abstract class BaseStreamInput extends InputStream {
+ // Maximum char-count to de-serialize via the thread-local CharsRef buffer
+ private static final int SMALL_STRING_LIMIT = 1024;
+ // Reusable bytes for deserializing strings
+ private static final ThreadLocal stringReadBuffer = ThreadLocal.withInitial(() -> new byte[1024]);
+ // Thread-local buffer for smaller strings
+ private static final ThreadLocal smallSpare = ThreadLocal.withInitial(() -> new CharsRef(SMALL_STRING_LIMIT));
+ private Version version = Version.CURRENT;
+ // Larger buffer used for long strings that can't fit into the thread-local buffer
+ // We don't use a CharsRefBuilder since we exactly know the size of the character array up front
+ // this prevents calling grow for every character since we don't need this
+ private CharsRef largeSpare;
+
+ /**
+ * The version of the node on the other side of this stream.
+ */
+ public Version getVersion() {
+ return this.version;
+ }
+
+ /**
+ * Set the version of the node on the other side of this stream.
+ */
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ /**
+ * Closes the stream to further operations.
+ */
+ @Override
+ public abstract void close() throws IOException;
+
+ @Override
+ public abstract int available() throws IOException;
+
+ /**
+ * This method throws an {@link EOFException} if the given number of bytes can not be read from the this stream. This method might
+ * be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.
+ */
+ protected abstract void ensureCanReadBytes(int length) throws EOFException;
+
+ /**
+ * Reads and returns a single byte.
+ */
+ public abstract byte readByte() throws IOException;
+
+ /**
+ * Reads a specified number of bytes into an array at the specified offset.
+ *
+ * @param b the array to read bytes into
+ * @param offset the offset in the array to start storing bytes
+ * @param len the number of bytes to read
+ */
+ public abstract void readBytes(byte[] b, int offset, int len) throws IOException;
+
+ public void readFully(byte[] b) throws IOException {
+ readBytes(b, 0, b.length);
+ }
+
+ protected boolean readBoolean(final byte value) {
+ if (value == 0) {
+ return false;
+ } else if (value == 1) {
+ return true;
+ } else {
+ final String message = String.format(Locale.ROOT, "unexpected byte [0x%02x]", value);
+ throw new IllegalStateException(message);
+ }
+ }
+
+ /**
+ * Reads a boolean.
+ */
+ public final boolean readBoolean() throws IOException {
+ return readBoolean(readByte());
+ }
+
+ @Nullable
+ public final Boolean readOptionalBoolean() throws IOException {
+ final byte value = readByte();
+ if (value == 2) {
+ return null;
+ } else {
+ return readBoolean(value);
+ }
+ }
+
+ /**
+ * Reads four bytes and returns an int.
+ */
+ public int readInt() throws IOException {
+ return ((readByte() & 0xFF) << 24) | ((readByte() & 0xFF) << 16) | ((readByte() & 0xFF) << 8) | (readByte() & 0xFF);
+ }
+
+ /**
+ * Reads an int stored in variable-length format. Reads between one and
+ * five bytes. Smaller values take fewer bytes. Negative numbers
+ * will always use all 5 bytes and are therefore better serialized
+ * using {@link #readInt}
+ */
+ public int readVInt() throws IOException {
+ byte b = readByte();
+ int i = b & 0x7F;
+ if ((b & 0x80) == 0) {
+ return i;
+ }
+ b = readByte();
+ i |= (b & 0x7F) << 7;
+ if ((b & 0x80) == 0) {
+ return i;
+ }
+ b = readByte();
+ i |= (b & 0x7F) << 14;
+ if ((b & 0x80) == 0) {
+ return i;
+ }
+ b = readByte();
+ i |= (b & 0x7F) << 21;
+ if ((b & 0x80) == 0) {
+ return i;
+ }
+ b = readByte();
+ if ((b & 0x80) != 0) {
+ throw new IOException("Invalid vInt ((" + Integer.toHexString(b) + " & 0x7f) << 28) | " + Integer.toHexString(i));
+ }
+ return i | ((b & 0x7F) << 28);
+ }
+
+ @Nullable
+ public Integer readOptionalVInt() throws IOException {
+ if (readBoolean()) {
+ return readVInt();
+ }
+ return null;
+ }
+
+ public String readString() throws IOException {
+ final int charCount = readArraySize();
+ final CharsRef charsRef;
+ if (charCount > SMALL_STRING_LIMIT) {
+ if (largeSpare == null) {
+ largeSpare = new CharsRef(ArrayUtil.oversize(charCount, Character.BYTES));
+ } else if (largeSpare.chars.length < charCount) {
+ // we don't use ArrayUtils.grow since there is no need to copy the array
+ largeSpare.chars = new char[ArrayUtil.oversize(charCount, Character.BYTES)];
+ }
+ charsRef = largeSpare;
+ } else {
+ charsRef = smallSpare.get();
+ }
+ charsRef.length = charCount;
+ int charsOffset = 0;
+ int offsetByteArray = 0;
+ int sizeByteArray = 0;
+ int missingFromPartial = 0;
+ final byte[] byteBuffer = stringReadBuffer.get();
+ final char[] charBuffer = charsRef.chars;
+ for (; charsOffset < charCount;) {
+ final int charsLeft = charCount - charsOffset;
+ int bufferFree = byteBuffer.length - sizeByteArray;
+ // Determine the minimum amount of bytes that are left in the string
+ final int minRemainingBytes;
+ if (missingFromPartial > 0) {
+ // One byte for each remaining char except for the already partially read char
+ minRemainingBytes = missingFromPartial + charsLeft - 1;
+ missingFromPartial = 0;
+ } else {
+ // Each char has at least a single byte
+ minRemainingBytes = charsLeft;
+ }
+ final int toRead;
+ if (bufferFree < minRemainingBytes) {
+ // We don't have enough space left in the byte array to read as much as we'd like to so we free up as many bytes in the
+ // buffer by moving unused bytes that didn't make up a full char in the last iteration to the beginning of the buffer,
+ // if there are any
+ if (offsetByteArray > 0) {
+ sizeByteArray = sizeByteArray - offsetByteArray;
+ switch (sizeByteArray) { // We only have 0, 1 or 2 => no need to bother with a native call to System#arrayCopy
+ case 1:
+ byteBuffer[0] = byteBuffer[offsetByteArray];
+ break;
+ case 2:
+ byteBuffer[0] = byteBuffer[offsetByteArray];
+ byteBuffer[1] = byteBuffer[offsetByteArray + 1];
+ break;
+ }
+ assert sizeByteArray <= 2 : "We never copy more than 2 bytes here since a char is 3 bytes max";
+ toRead = Math.min(bufferFree + offsetByteArray, minRemainingBytes);
+ offsetByteArray = 0;
+ } else {
+ toRead = bufferFree;
+ }
+ } else {
+ toRead = minRemainingBytes;
+ }
+ readBytes(byteBuffer, sizeByteArray, toRead);
+ sizeByteArray += toRead;
+ // As long as we at least have three bytes buffered we don't need to do any bounds checking when getting the next char since we
+ // read 3 bytes per char/iteration at most
+ for (; offsetByteArray < sizeByteArray - 2; offsetByteArray++) {
+ final int c = byteBuffer[offsetByteArray] & 0xff;
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charBuffer[charsOffset++] = (char) c;
+ break;
+ case 12:
+ case 13:
+ charBuffer[charsOffset++] = (char) ((c & 0x1F) << 6 | byteBuffer[++offsetByteArray] & 0x3F);
+ break;
+ case 14:
+ charBuffer[charsOffset++] = (char) ((c & 0x0F) << 12 | (byteBuffer[++offsetByteArray] & 0x3F) << 6
+ | (byteBuffer[++offsetByteArray] & 0x3F));
+ break;
+ default:
+ BaseStreamInput.throwOnBrokenChar(c);
+ }
+ }
+ // try to extract chars from remaining bytes with bounds checks for multi-byte chars
+ final int bufferedBytesRemaining = sizeByteArray - offsetByteArray;
+ for (int i = 0; i < bufferedBytesRemaining; i++) {
+ final int c = byteBuffer[offsetByteArray] & 0xff;
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charBuffer[charsOffset++] = (char) c;
+ offsetByteArray++;
+ break;
+ case 12:
+ case 13:
+ missingFromPartial = 2 - (bufferedBytesRemaining - i);
+ if (missingFromPartial == 0) {
+ offsetByteArray++;
+ charBuffer[charsOffset++] = (char) ((c & 0x1F) << 6 | byteBuffer[offsetByteArray++] & 0x3F);
+ }
+ ++i;
+ break;
+ case 14:
+ missingFromPartial = 3 - (bufferedBytesRemaining - i);
+ ++i;
+ break;
+ default:
+ BaseStreamInput.throwOnBrokenChar(c);
+ }
+ }
+ }
+ return charsRef.toString();
+ }
+
+ @Nullable
+ public String readOptionalString() throws IOException {
+ if (readBoolean()) {
+ return readString();
+ }
+ return null;
+ }
+
+ private static void throwOnBrokenChar(int c) throws IOException {
+ throw new IOException("Invalid string; unexpected character: " + c + " hex: " + Integer.toHexString(c));
+ }
+
+ /**
+ * Reads a vint via {@link #readVInt()} and applies basic checks to ensure the read array size is sane.
+ * This method uses {@link #ensureCanReadBytes(int)} to ensure this stream has enough bytes to read for the read array size.
+ */
+ protected int readArraySize() throws IOException {
+ final int arraySize = readVInt();
+ if (arraySize > ArrayUtil.MAX_ARRAY_LENGTH) {
+ throw new IllegalStateException("array length must be <= to " + ArrayUtil.MAX_ARRAY_LENGTH + " but was: " + arraySize);
+ }
+ if (arraySize < 0) {
+ throw new NegativeArraySizeException("array size must be positive but was: " + arraySize);
+ }
+ // lets do a sanity check that if we are reading an array size that is bigger that the remaining bytes we can safely
+ // throw an exception instead of allocating the array based on the size. A simple corrutpted byte can make a node go OOM
+ // if the size is large and for perf reasons we allocate arrays ahead of time
+ ensureCanReadBytes(arraySize);
+ return arraySize;
+ }
+
+ /**
+ * Reads a collection of objects
+ */
+ @SuppressWarnings("unchecked")
+ protected > C readCollection(
+ BaseWriteable.Reader reader,
+ IntFunction constructor,
+ C empty
+ ) throws IOException {
+ int count = readArraySize();
+ if (count == 0) {
+ return empty;
+ }
+ C builder = constructor.apply(count);
+ for (int i = 0; i < count; i++) {
+ builder.add(reader.read((S) this));
+ }
+ return builder;
+ }
+}
diff --git a/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamOutput.java b/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamOutput.java
index f7a8862fa5f2c..e2d4edf0a6023 100644
--- a/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamOutput.java
+++ b/libs/core/src/main/java/org/opensearch/core/common/io/stream/BaseStreamOutput.java
@@ -7,6 +7,10 @@
*/
package org.opensearch.core.common.io.stream;
+import org.opensearch.Version;
+import org.opensearch.common.Nullable;
+
+import java.io.IOException;
import java.io.OutputStream;
/**
@@ -16,4 +20,131 @@
*
* @opensearch.internal
*/
-public abstract class BaseStreamOutput extends OutputStream {}
+public abstract class BaseStreamOutput extends OutputStream {
+ protected static final ThreadLocal scratch = ThreadLocal.withInitial(() -> new byte[1024]);
+ private static byte ZERO = 0;
+ private static byte ONE = 1;
+ private static byte TWO = 2;
+ protected Version version = Version.CURRENT;
+
+ /**
+ * The version of the node on the other side of this stream.
+ */
+ public Version getVersion() {
+ return this.version;
+ }
+
+ /**
+ * Set the version of the node on the other side of this stream.
+ */
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ /**
+ * Closes this stream to further operations.
+ */
+ @Override
+ public abstract void close() throws IOException;
+
+ /**
+ * Forces any buffered output to be written.
+ */
+ @Override
+ public abstract void flush() throws IOException;
+
+ public abstract void reset() throws IOException;
+
+ /**
+ * Writes a single byte.
+ */
+ public abstract void writeByte(byte b) throws IOException;
+
+ /**
+ * Writes an array of bytes.
+ *
+ * @param b the bytes to write
+ * @param offset the offset in the byte array
+ * @param length the number of bytes to write
+ */
+ public abstract void writeBytes(byte[] b, int offset, int length) throws IOException;
+
+ /**
+ * Writes a boolean.
+ */
+ public void writeBoolean(boolean b) throws IOException {
+ writeByte(b ? ONE : ZERO);
+ }
+
+ public void writeOptionalBoolean(@Nullable Boolean b) throws IOException {
+ if (b == null) {
+ writeByte(TWO);
+ } else {
+ writeBoolean(b);
+ }
+ }
+
+ /**
+ * Writes an int as four bytes.
+ */
+ public void writeInt(int i) throws IOException {
+ final byte[] buffer = scratch.get();
+ buffer[0] = (byte) (i >> 24);
+ buffer[1] = (byte) (i >> 16);
+ buffer[2] = (byte) (i >> 8);
+ buffer[3] = (byte) i;
+ writeBytes(buffer, 0, 4);
+ }
+
+ /**
+ * Writes an optional {@link Integer}.
+ */
+ public void writeOptionalInt(@Nullable Integer integer) throws IOException {
+ if (integer == null) {
+ writeBoolean(false);
+ } else {
+ writeBoolean(true);
+ writeInt(integer);
+ }
+ }
+
+ /**
+ * Writes an int in a variable-length format. Writes between one and
+ * five bytes. Smaller values take fewer bytes. Negative numbers
+ * will always use all 5 bytes and are therefore better serialized
+ * using {@link #writeInt}
+ */
+ public void writeVInt(int i) throws IOException {
+ /*
+ * Shortcut writing single byte because it is very, very common and
+ * can skip grabbing the scratch buffer. This is marginally slower
+ * than hand unrolling the entire encoding loop but hand unrolling
+ * the encoding loop blows out the method size so it can't be inlined.
+ * In that case benchmarks of the method itself are faster but
+ * benchmarks of methods that use this method are slower.
+ * This is philosophically in line with vint in general - it biases
+ * twoards being simple and fast for smaller numbers.
+ */
+ if (Integer.numberOfLeadingZeros(i) >= 25) {
+ writeByte((byte) i);
+ return;
+ }
+ byte[] buffer = scratch.get();
+ int index = 0;
+ do {
+ buffer[index++] = ((byte) ((i & 0x7f) | 0x80));
+ i >>>= 7;
+ } while ((i & ~0x7F) != 0);
+ buffer[index++] = ((byte) i);
+ writeBytes(buffer, 0, index);
+ }
+
+ public void writeOptionalVInt(@Nullable Integer integer) throws IOException {
+ if (integer == null) {
+ writeBoolean(false);
+ } else {
+ writeBoolean(true);
+ writeVInt(integer);
+ }
+ }
+}
diff --git a/server/src/main/java/org/opensearch/common/lease/Releasable.java b/libs/core/src/main/java/org/opensearch/core/common/lease/Releasable.java
similarity index 92%
rename from server/src/main/java/org/opensearch/common/lease/Releasable.java
rename to libs/core/src/main/java/org/opensearch/core/common/lease/Releasable.java
index 4b167ff29ee71..38d153f13b932 100644
--- a/server/src/main/java/org/opensearch/common/lease/Releasable.java
+++ b/libs/core/src/main/java/org/opensearch/core/common/lease/Releasable.java
@@ -30,14 +30,12 @@
* GitHub history for details.
*/
-package org.opensearch.common.lease;
-
-import org.opensearch.OpenSearchException;
+package org.opensearch.core.common.lease;
import java.io.Closeable;
/**
- * Specialization of {@link AutoCloseable} that may only throw an {@link OpenSearchException}.
+ * Specialization of {@link AutoCloseable} that may only throw an {@code BaseOpenSearchException}.
*
* @opensearch.internal
*/
diff --git a/server/src/main/java/org/opensearch/common/lease/Releasables.java b/libs/core/src/main/java/org/opensearch/core/common/lease/Releasables.java
similarity index 99%
rename from server/src/main/java/org/opensearch/common/lease/Releasables.java
rename to libs/core/src/main/java/org/opensearch/core/common/lease/Releasables.java
index 31bfa9a2dd7ab..2d02b82924bac 100644
--- a/server/src/main/java/org/opensearch/common/lease/Releasables.java
+++ b/libs/core/src/main/java/org/opensearch/core/common/lease/Releasables.java
@@ -30,7 +30,7 @@
* GitHub history for details.
*/
-package org.opensearch.common.lease;
+package org.opensearch.core.common.lease;
import org.opensearch.common.Nullable;
import org.opensearch.common.util.io.IOUtils;
diff --git a/server/src/main/java/org/opensearch/common/lease/package-info.java b/libs/core/src/main/java/org/opensearch/core/common/lease/package-info.java
similarity index 85%
rename from server/src/main/java/org/opensearch/common/lease/package-info.java
rename to libs/core/src/main/java/org/opensearch/core/common/lease/package-info.java
index f7097486a9c64..ffb6a7e106bb5 100644
--- a/server/src/main/java/org/opensearch/common/lease/package-info.java
+++ b/libs/core/src/main/java/org/opensearch/core/common/lease/package-info.java
@@ -7,4 +7,4 @@
*/
/** Base Releasables package. */
-package org.opensearch.common.lease;
+package org.opensearch.core.common.lease;
diff --git a/modules/aggs-matrix-stats/src/main/java/org/opensearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java b/modules/aggs-matrix-stats/src/main/java/org/opensearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java
index 142e7ca3dbc15..045b79ed5bcd1 100644
--- a/modules/aggs-matrix-stats/src/main/java/org/opensearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java
+++ b/modules/aggs-matrix-stats/src/main/java/org/opensearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java
@@ -33,9 +33,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.NumericDoubleValues;
import org.opensearch.search.MultiValueMode;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridAggregator.java b/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridAggregator.java
index db07ac8f947e5..1fa441999a6a2 100644
--- a/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridAggregator.java
+++ b/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/bucket/geogrid/GeoGridAggregator.java
@@ -34,7 +34,7 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
import org.opensearch.search.aggregations.CardinalityUpperBound;
diff --git a/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/metrics/AbstractGeoBoundsAggregator.java b/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/metrics/AbstractGeoBoundsAggregator.java
index 4a39fa1da04eb..8d467df52626c 100644
--- a/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/metrics/AbstractGeoBoundsAggregator.java
+++ b/modules/geo/src/main/java/org/opensearch/geo/search/aggregations/metrics/AbstractGeoBoundsAggregator.java
@@ -8,9 +8,9 @@
package org.opensearch.geo.search.aggregations.metrics;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.InternalAggregation;
import org.opensearch.search.aggregations.metrics.MetricsAggregator;
diff --git a/modules/parent-join/src/main/java/org/opensearch/join/aggregations/ParentJoinAggregator.java b/modules/parent-join/src/main/java/org/opensearch/join/aggregations/ParentJoinAggregator.java
index 4e1016a596874..5f9f1e66587f0 100644
--- a/modules/parent-join/src/main/java/org/opensearch/join/aggregations/ParentJoinAggregator.java
+++ b/modules/parent-join/src/main/java/org/opensearch/join/aggregations/ParentJoinAggregator.java
@@ -41,11 +41,11 @@
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.Bits;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
import org.opensearch.search.aggregations.CardinalityUpperBound;
diff --git a/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4MessageChannelHandler.java b/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4MessageChannelHandler.java
index ad2e287f7a28d..255f486fd1cbb 100644
--- a/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4MessageChannelHandler.java
+++ b/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4MessageChannelHandler.java
@@ -42,8 +42,8 @@
import org.opensearch.ExceptionsHelper;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.InboundPipeline;
import org.opensearch.transport.Transport;
diff --git a/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4Transport.java b/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4Transport.java
index 444cf420e4110..3f0cf7a757acc 100644
--- a/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4Transport.java
+++ b/modules/transport-netty4/src/main/java/org/opensearch/transport/netty4/Netty4Transport.java
@@ -53,7 +53,6 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.network.NetworkService;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
@@ -63,6 +62,7 @@
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
import org.opensearch.common.util.net.NetUtils;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.indices.breaker.CircuitBreakerService;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.Netty4NioSocketChannel;
diff --git a/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/TcpReadWriteHandler.java b/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/TcpReadWriteHandler.java
index 9c9179c584a38..5464018c08f71 100644
--- a/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/TcpReadWriteHandler.java
+++ b/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/TcpReadWriteHandler.java
@@ -36,10 +36,10 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.bytes.CompositeBytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.nio.BytesWriteHandler;
import org.opensearch.nio.InboundChannelBuffer;
import org.opensearch.nio.Page;
diff --git a/server/src/internalClusterTest/java/org/opensearch/index/IndexingPressureIT.java b/server/src/internalClusterTest/java/org/opensearch/index/IndexingPressureIT.java
index 17bd8bbe0ae80..b69b860f3b69c 100644
--- a/server/src/internalClusterTest/java/org/opensearch/index/IndexingPressureIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/index/IndexingPressureIT.java
@@ -44,8 +44,8 @@
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.UUIDs;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.plugins.Plugin;
import org.opensearch.test.OpenSearchIntegTestCase;
diff --git a/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java b/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java
index 98541310649db..c04738dce8e8e 100644
--- a/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java
@@ -12,9 +12,9 @@
import org.opensearch.action.index.IndexRequest;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.UUIDs;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.shard.IndexShardState;
diff --git a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureIT.java b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureIT.java
index 4bb3b53b9a59f..f37daabed5abf 100644
--- a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureIT.java
@@ -20,8 +20,8 @@
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.UUIDs;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.IndicesService;
diff --git a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java
index 393e867f2e578..28ce5f30a52a8 100644
--- a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java
@@ -22,8 +22,8 @@
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.UUIDs;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.IndicesService;
diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationBaseIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationBaseIT.java
index 4c839a4c6d9dd..f88b9f2777da4 100644
--- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationBaseIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationBaseIT.java
@@ -17,8 +17,8 @@
import org.opensearch.cluster.routing.IndexShardRoutingTable;
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexService;
diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java
index 0d982b92cd80e..c4420922d1dcb 100644
--- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java
@@ -43,10 +43,10 @@
import org.opensearch.cluster.routing.ShardRoutingState;
import org.opensearch.cluster.routing.allocation.command.CancelAllocationCommand;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexModule;
import org.opensearch.index.SegmentReplicationPerGroupStats;
import org.opensearch.index.SegmentReplicationPressureService;
diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java
index 3bd349fbdd575..05a50535b59da 100644
--- a/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java
+++ b/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java
@@ -39,9 +39,9 @@
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.Glob;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.concurrent.RunOnce;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.common.Strings;
import org.opensearch.plugins.Plugin;
import org.opensearch.test.OpenSearchIntegTestCase;
diff --git a/server/src/main/java/org/opensearch/OpenSearchException.java b/server/src/main/java/org/opensearch/OpenSearchException.java
index a9801ad62105e..5d258b338f57e 100644
--- a/server/src/main/java/org/opensearch/OpenSearchException.java
+++ b/server/src/main/java/org/opensearch/OpenSearchException.java
@@ -55,16 +55,13 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import static java.util.Collections.unmodifiableMap;
+import static org.opensearch.BaseOpenSearchException.OpenSearchExceptionHandleRegistry.registerExceptionHandle;
import static org.opensearch.Version.V_2_1_0;
import static org.opensearch.Version.V_2_4_0;
import static org.opensearch.Version.V_2_5_0;
@@ -87,10 +84,1187 @@ public class OpenSearchException extends BaseOpenSearchException implements Writ
*/
private static final int CUSTOM_ELASTICSEARCH_EXCEPTIONS_BASE_ID = 10000;
- private static final Map> ID_TO_SUPPLIER;
- private static final Map, OpenSearchExceptionHandle> CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE;
-
- private static final Pattern OS_METADATA = Pattern.compile("^opensearch\\.");
+ static {
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.snapshots.IndexShardSnapshotFailedException.class,
+ org.opensearch.index.snapshots.IndexShardSnapshotFailedException::new,
+ 0,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.dfs.DfsPhaseExecutionException.class,
+ org.opensearch.search.dfs.DfsPhaseExecutionException::new,
+ 1,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.util.CancellableThreads.ExecutionCancelledException.class,
+ org.opensearch.common.util.CancellableThreads.ExecutionCancelledException::new,
+ 2,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.discovery.ClusterManagerNotDiscoveredException.class,
+ org.opensearch.discovery.ClusterManagerNotDiscoveredException::new,
+ 3,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.OpenSearchSecurityException.class,
+ org.opensearch.OpenSearchSecurityException::new,
+ 4,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.snapshots.IndexShardRestoreException.class,
+ org.opensearch.index.snapshots.IndexShardRestoreException::new,
+ 5,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.IndexClosedException.class,
+ org.opensearch.indices.IndexClosedException::new,
+ 6,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.http.BindHttpException.class,
+ org.opensearch.http.BindHttpException::new,
+ 7,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.search.ReduceSearchPhaseException.class,
+ org.opensearch.action.search.ReduceSearchPhaseException::new,
+ 8,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.node.NodeClosedException.class,
+ org.opensearch.node.NodeClosedException::new,
+ 9,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.SnapshotFailedEngineException.class,
+ org.opensearch.index.engine.SnapshotFailedEngineException::new,
+ 10,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.ShardNotFoundException.class,
+ org.opensearch.index.shard.ShardNotFoundException::new,
+ 11,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.ConnectTransportException.class,
+ org.opensearch.transport.ConnectTransportException::new,
+ 12,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NotSerializableTransportException.class,
+ org.opensearch.transport.NotSerializableTransportException::new,
+ 13,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.ResponseHandlerFailureTransportException.class,
+ org.opensearch.transport.ResponseHandlerFailureTransportException::new,
+ 14,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.IndexCreationException.class,
+ org.opensearch.indices.IndexCreationException::new,
+ 15,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.IndexNotFoundException.class,
+ org.opensearch.index.IndexNotFoundException::new,
+ 16,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.routing.IllegalShardRoutingStateException.class,
+ org.opensearch.cluster.routing.IllegalShardRoutingStateException::new,
+ 17,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.support.broadcast.BroadcastShardOperationFailedException.class,
+ org.opensearch.action.support.broadcast.BroadcastShardOperationFailedException::new,
+ 18,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.ResourceNotFoundException.class,
+ org.opensearch.ResourceNotFoundException::new,
+ 19,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.ActionTransportException.class,
+ org.opensearch.transport.ActionTransportException::new,
+ 20,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.OpenSearchGenerationException.class,
+ org.opensearch.OpenSearchGenerationException::new,
+ 21,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 22 was CreateFailedEngineException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardStartedException.class,
+ org.opensearch.index.shard.IndexShardStartedException::new,
+ 23,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.SearchContextMissingException.class,
+ org.opensearch.search.SearchContextMissingException::new,
+ 24,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.script.GeneralScriptException.class,
+ org.opensearch.script.GeneralScriptException::new,
+ 25,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 26 was BatchOperationException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.SnapshotCreationException.class,
+ org.opensearch.snapshots.SnapshotCreationException::new,
+ 27,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 28 was DeleteFailedEngineException, deprecated in 6.0, removed in 7.0
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.DocumentMissingException.class,
+ org.opensearch.index.engine.DocumentMissingException::new,
+ 29,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.SnapshotException.class,
+ org.opensearch.snapshots.SnapshotException::new,
+ 30,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.InvalidAliasNameException.class,
+ org.opensearch.indices.InvalidAliasNameException::new,
+ 31,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.InvalidIndexNameException.class,
+ org.opensearch.indices.InvalidIndexNameException::new,
+ 32,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.IndexPrimaryShardNotAllocatedException.class,
+ org.opensearch.indices.IndexPrimaryShardNotAllocatedException::new,
+ 33,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.TransportException.class,
+ org.opensearch.transport.TransportException::new,
+ 34,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.OpenSearchParseException.class,
+ org.opensearch.OpenSearchParseException::new,
+ 35,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.SearchException.class,
+ org.opensearch.search.SearchException::new,
+ 36,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.mapper.MapperException.class,
+ org.opensearch.index.mapper.MapperException::new,
+ 37,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.InvalidTypeNameException.class,
+ org.opensearch.indices.InvalidTypeNameException::new,
+ 38,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.SnapshotRestoreException.class,
+ org.opensearch.snapshots.SnapshotRestoreException::new,
+ 39,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.ParsingException.class,
+ org.opensearch.common.ParsingException::new,
+ 40,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardClosedException.class,
+ org.opensearch.index.shard.IndexShardClosedException::new,
+ 41,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.recovery.RecoverFilesRecoveryException.class,
+ org.opensearch.indices.recovery.RecoverFilesRecoveryException::new,
+ 42,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.translog.TruncatedTranslogException.class,
+ org.opensearch.index.translog.TruncatedTranslogException::new,
+ 43,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.recovery.RecoveryFailedException.class,
+ org.opensearch.indices.recovery.RecoveryFailedException::new,
+ 44,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardRelocatedException.class,
+ org.opensearch.index.shard.IndexShardRelocatedException::new,
+ 45,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NodeShouldNotConnectException.class,
+ org.opensearch.transport.NodeShouldNotConnectException::new,
+ 46,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 47 used to be for IndexTemplateAlreadyExistsException which was deprecated in 5.1 removed in 6.0
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.translog.TranslogCorruptedException.class,
+ org.opensearch.index.translog.TranslogCorruptedException::new,
+ 48,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.block.ClusterBlockException.class,
+ org.opensearch.cluster.block.ClusterBlockException::new,
+ 49,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.fetch.FetchPhaseExecutionException.class,
+ org.opensearch.search.fetch.FetchPhaseExecutionException::new,
+ 50,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 51 used to be for IndexShardAlreadyExistsException which was deprecated in 5.1 removed in 6.0
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.VersionConflictEngineException.class,
+ org.opensearch.index.engine.VersionConflictEngineException::new,
+ 52,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.EngineException.class,
+ org.opensearch.index.engine.EngineException::new,
+ 53,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 54 was DocumentAlreadyExistsException, which is superseded by VersionConflictEngineException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.NoSuchNodeException.class,
+ org.opensearch.action.NoSuchNodeException::new,
+ 55,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.settings.SettingsException.class,
+ org.opensearch.common.settings.SettingsException::new,
+ 56,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.IndexTemplateMissingException.class,
+ org.opensearch.indices.IndexTemplateMissingException::new,
+ 57,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.SendRequestTransportException.class,
+ org.opensearch.transport.SendRequestTransportException::new,
+ 58,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 59 used to be OpenSearchRejectedExecutionException
+ // 60 used to be for EarlyTerminationException
+ // 61 used to be for RoutingValidationException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.io.stream.NotSerializableExceptionWrapper.class,
+ org.opensearch.common.io.stream.NotSerializableExceptionWrapper::new,
+ 62,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.AliasFilterParsingException.class,
+ org.opensearch.indices.AliasFilterParsingException::new,
+ 63,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 64 was DeleteByQueryFailedEngineException, which was removed in 5.0
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.gateway.GatewayException.class,
+ org.opensearch.gateway.GatewayException::new,
+ 65,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardNotRecoveringException.class,
+ org.opensearch.index.shard.IndexShardNotRecoveringException::new,
+ 66,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.http.HttpException.class,
+ org.opensearch.http.HttpException::new,
+ 67,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(OpenSearchException.class, OpenSearchException::new, 68, UNKNOWN_VERSION_ADDED)
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.SnapshotMissingException.class,
+ org.opensearch.snapshots.SnapshotMissingException::new,
+ 69,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.PrimaryMissingActionException.class,
+ org.opensearch.action.PrimaryMissingActionException::new,
+ 70,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.SearchParseException.class,
+ org.opensearch.search.SearchParseException::new,
+ 72,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.FailedNodeException.class,
+ org.opensearch.action.FailedNodeException::new,
+ 71,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.ConcurrentSnapshotExecutionException.class,
+ org.opensearch.snapshots.ConcurrentSnapshotExecutionException::new,
+ 73,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.blobstore.BlobStoreException.class,
+ org.opensearch.common.blobstore.BlobStoreException::new,
+ 74,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.IncompatibleClusterStateVersionException.class,
+ org.opensearch.cluster.IncompatibleClusterStateVersionException::new,
+ 75,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.RecoveryEngineException.class,
+ org.opensearch.index.engine.RecoveryEngineException::new,
+ 76,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.util.concurrent.UncategorizedExecutionException.class,
+ org.opensearch.common.util.concurrent.UncategorizedExecutionException::new,
+ 77,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.TimestampParsingException.class,
+ org.opensearch.action.TimestampParsingException::new,
+ 78,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.RoutingMissingException.class,
+ org.opensearch.action.RoutingMissingException::new,
+ 79,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 80 was IndexFailedEngineException, deprecated in 6.0, removed in 7.0
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.snapshots.IndexShardRestoreFailedException.class,
+ org.opensearch.index.snapshots.IndexShardRestoreFailedException::new,
+ 81,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.repositories.RepositoryException.class,
+ org.opensearch.repositories.RepositoryException::new,
+ 82,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.ReceiveTimeoutTransportException.class,
+ org.opensearch.transport.ReceiveTimeoutTransportException::new,
+ 83,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NodeDisconnectedException.class,
+ org.opensearch.transport.NodeDisconnectedException::new,
+ 84,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 85 used to be for AlreadyExpiredException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.aggregations.AggregationExecutionException.class,
+ org.opensearch.search.aggregations.AggregationExecutionException::new,
+ 86,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 87 used to be for MergeMappingException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.InvalidIndexTemplateException.class,
+ org.opensearch.indices.InvalidIndexTemplateException::new,
+ 88,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.RefreshFailedEngineException.class,
+ org.opensearch.index.engine.RefreshFailedEngineException::new,
+ 90,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.aggregations.AggregationInitializationException.class,
+ org.opensearch.search.aggregations.AggregationInitializationException::new,
+ 91,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.recovery.DelayRecoveryException.class,
+ org.opensearch.indices.recovery.DelayRecoveryException::new,
+ 92,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 93 used to be for IndexWarmerMissingException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.client.transport.NoNodeAvailableException.class,
+ org.opensearch.client.transport.NoNodeAvailableException::new,
+ 94,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.InvalidSnapshotNameException.class,
+ org.opensearch.snapshots.InvalidSnapshotNameException::new,
+ 96,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IllegalIndexShardStateException.class,
+ org.opensearch.index.shard.IllegalIndexShardStateException::new,
+ 97,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.snapshots.IndexShardSnapshotException.class,
+ org.opensearch.index.snapshots.IndexShardSnapshotException::new,
+ 98,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardNotStartedException.class,
+ org.opensearch.index.shard.IndexShardNotStartedException::new,
+ 99,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.search.SearchPhaseExecutionException.class,
+ org.opensearch.action.search.SearchPhaseExecutionException::new,
+ 100,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.ActionNotFoundTransportException.class,
+ org.opensearch.transport.ActionNotFoundTransportException::new,
+ 101,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.TransportSerializationException.class,
+ org.opensearch.transport.TransportSerializationException::new,
+ 102,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.RemoteTransportException.class,
+ org.opensearch.transport.RemoteTransportException::new,
+ 103,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.EngineCreationFailureException.class,
+ org.opensearch.index.engine.EngineCreationFailureException::new,
+ 104,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.routing.RoutingException.class,
+ org.opensearch.cluster.routing.RoutingException::new,
+ 105,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardRecoveryException.class,
+ org.opensearch.index.shard.IndexShardRecoveryException::new,
+ 106,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.repositories.RepositoryMissingException.class,
+ org.opensearch.repositories.RepositoryMissingException::new,
+ 107,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.DocumentSourceMissingException.class,
+ org.opensearch.index.engine.DocumentSourceMissingException::new,
+ 109,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 110 used to be FlushNotAllowedEngineException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.settings.NoClassSettingsException.class,
+ org.opensearch.common.settings.NoClassSettingsException::new,
+ 111,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.BindTransportException.class,
+ org.opensearch.transport.BindTransportException::new,
+ 112,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.rest.action.admin.indices.AliasesNotFoundException.class,
+ org.opensearch.rest.action.admin.indices.AliasesNotFoundException::new,
+ 113,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.IndexShardRecoveringException.class,
+ org.opensearch.index.shard.IndexShardRecoveringException::new,
+ 114,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.translog.TranslogException.class,
+ org.opensearch.index.translog.TranslogException::new,
+ 115,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.metadata.ProcessClusterEventTimeoutException.class,
+ org.opensearch.cluster.metadata.ProcessClusterEventTimeoutException::new,
+ 116,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ ReplicationOperation.RetryOnPrimaryException.class,
+ ReplicationOperation.RetryOnPrimaryException::new,
+ 117,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.OpenSearchTimeoutException.class,
+ org.opensearch.OpenSearchTimeoutException::new,
+ 118,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.query.QueryPhaseExecutionException.class,
+ org.opensearch.search.query.QueryPhaseExecutionException::new,
+ 119,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.repositories.RepositoryVerificationException.class,
+ org.opensearch.repositories.RepositoryVerificationException::new,
+ 120,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.aggregations.InvalidAggregationPathException.class,
+ org.opensearch.search.aggregations.InvalidAggregationPathException::new,
+ 121,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 123 used to be IndexAlreadyExistsException and was renamed
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ ResourceAlreadyExistsException.class,
+ ResourceAlreadyExistsException::new,
+ 123,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 124 used to be Script.ScriptParseException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ TcpTransport.HttpRequestOnTransportException.class,
+ TcpTransport.HttpRequestOnTransportException::new,
+ 125,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.mapper.MapperParsingException.class,
+ org.opensearch.index.mapper.MapperParsingException::new,
+ 126,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 127 used to be org.opensearch.search.SearchContextException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.search.builder.SearchSourceBuilderException.class,
+ org.opensearch.search.builder.SearchSourceBuilderException::new,
+ 128,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 129 was EngineClosedException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.NoShardAvailableActionException.class,
+ org.opensearch.action.NoShardAvailableActionException::new,
+ 130,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.UnavailableShardsException.class,
+ org.opensearch.action.UnavailableShardsException::new,
+ 131,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.engine.FlushFailedEngineException.class,
+ org.opensearch.index.engine.FlushFailedEngineException::new,
+ 132,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.common.breaker.CircuitBreakingException.class,
+ org.opensearch.common.breaker.CircuitBreakingException::new,
+ 133,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NodeNotConnectedException.class,
+ org.opensearch.transport.NodeNotConnectedException::new,
+ 134,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.mapper.StrictDynamicMappingException.class,
+ org.opensearch.index.mapper.StrictDynamicMappingException::new,
+ 135,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException.class,
+ org.opensearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException::new,
+ 136,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.TypeMissingException.class,
+ org.opensearch.indices.TypeMissingException::new,
+ 137,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.coordination.FailedToCommitClusterStateException.class,
+ org.opensearch.cluster.coordination.FailedToCommitClusterStateException::new,
+ 140,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.query.QueryShardException.class,
+ org.opensearch.index.query.QueryShardException::new,
+ 141,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ ShardStateAction.NoLongerPrimaryShardException.class,
+ ShardStateAction.NoLongerPrimaryShardException::new,
+ 142,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.script.ScriptException.class,
+ org.opensearch.script.ScriptException::new,
+ 143,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.NotClusterManagerException.class,
+ org.opensearch.cluster.NotClusterManagerException::new,
+ 144,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.OpenSearchStatusException.class,
+ org.opensearch.OpenSearchStatusException::new,
+ 145,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.tasks.TaskCancelledException.class,
+ org.opensearch.tasks.TaskCancelledException::new,
+ 146,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.env.ShardLockObtainFailedException.class,
+ org.opensearch.env.ShardLockObtainFailedException::new,
+ 147,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ // 148 was UnknownNamedObjectException
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ MultiBucketConsumerService.TooManyBucketsException.class,
+ MultiBucketConsumerService.TooManyBucketsException::new,
+ 149,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.coordination.CoordinationStateRejectedException.class,
+ org.opensearch.cluster.coordination.CoordinationStateRejectedException::new,
+ 150,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.snapshots.SnapshotInProgressException.class,
+ org.opensearch.snapshots.SnapshotInProgressException::new,
+ 151,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NoSuchRemoteClusterException.class,
+ org.opensearch.transport.NoSuchRemoteClusterException::new,
+ 152,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.seqno.RetentionLeaseAlreadyExistsException.class,
+ org.opensearch.index.seqno.RetentionLeaseAlreadyExistsException::new,
+ 153,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.seqno.RetentionLeaseNotFoundException.class,
+ org.opensearch.index.seqno.RetentionLeaseNotFoundException::new,
+ 154,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.ShardNotInPrimaryModeException.class,
+ org.opensearch.index.shard.ShardNotInPrimaryModeException::new,
+ 155,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException.class,
+ org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException::new,
+ 156,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.ingest.IngestProcessorException.class,
+ org.opensearch.ingest.IngestProcessorException::new,
+ 157,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.recovery.PeerRecoveryNotFound.class,
+ org.opensearch.indices.recovery.PeerRecoveryNotFound::new,
+ 158,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.coordination.NodeHealthCheckFailureException.class,
+ org.opensearch.cluster.coordination.NodeHealthCheckFailureException::new,
+ 159,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.transport.NoSeedNodeLeftException.class,
+ org.opensearch.transport.NoSeedNodeLeftException::new,
+ 160,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.indices.replication.common.ReplicationFailedException.class,
+ org.opensearch.indices.replication.common.ReplicationFailedException::new,
+ 161,
+ V_2_1_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.index.shard.PrimaryShardClosedException.class,
+ org.opensearch.index.shard.PrimaryShardClosedException::new,
+ 162,
+ V_3_0_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.decommission.DecommissioningFailedException.class,
+ org.opensearch.cluster.decommission.DecommissioningFailedException::new,
+ 163,
+ V_2_4_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.decommission.NodeDecommissionedException.class,
+ org.opensearch.cluster.decommission.NodeDecommissionedException::new,
+ 164,
+ V_3_0_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ ClusterManagerThrottlingException.class,
+ ClusterManagerThrottlingException::new,
+ 165,
+ Version.V_2_5_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ SnapshotInUseDeletionException.class,
+ SnapshotInUseDeletionException::new,
+ 166,
+ UNKNOWN_VERSION_ADDED
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ UnsupportedWeightedRoutingStateException.class,
+ UnsupportedWeightedRoutingStateException::new,
+ 167,
+ V_2_5_0
+ )
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ PreferenceBasedSearchNotAllowedException.class,
+ PreferenceBasedSearchNotAllowedException::new,
+ 168,
+ V_2_6_0
+ )
+ );
+ registerExceptionHandle(new OpenSearchExceptionHandle(NodeWeighedAwayException.class, NodeWeighedAwayException::new, 169, V_2_6_0));
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(SearchPipelineProcessingException.class, SearchPipelineProcessingException::new, 170, V_2_7_0)
+ );
+ registerExceptionHandle(
+ new OpenSearchExceptionHandle(
+ org.opensearch.cluster.block.IndexCreateBlockException.class,
+ org.opensearch.cluster.block.IndexCreateBlockException::new,
+ CUSTOM_ELASTICSEARCH_EXCEPTIONS_BASE_ID + 1,
+ V_3_0_0
+ )
+ );
+ }
/**
* Construct a OpenSearchException
with the specified cause exception.
@@ -155,34 +1329,22 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
}
- public static OpenSearchException readException(StreamInput input, int id) throws IOException {
- CheckedFunction opensearchException = ID_TO_SUPPLIER.get(id);
- if (opensearchException == null) {
- throw new IllegalStateException("unknown exception for id: " + id);
- }
- return opensearchException.apply(input);
- }
-
/**
* Returns true
iff the given class is a registered for an exception to be read.
*/
- public static boolean isRegistered(Class extends Throwable> exception, Version version) {
- OpenSearchExceptionHandle openSearchExceptionHandle = CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE.get(exception);
- if (openSearchExceptionHandle != null) {
- return version.onOrAfter(openSearchExceptionHandle.versionAdded);
- }
- return false;
+ public static boolean isRegistered(final Class extends Throwable> exception, Version version) {
+ return OpenSearchExceptionHandleRegistry.isRegistered(exception, version);
}
- static Set> getRegisteredKeys() { // for testing
- return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE.keySet();
+ static Set> getRegisteredKeys() { // for testing
+ return OpenSearchExceptionHandleRegistry.getRegisteredKeys();
}
/**
* Returns the serialization id the given exception.
*/
- public static int getId(Class extends OpenSearchException> exception) {
- return CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE.get(exception).id;
+ public static int getId(final Class extends OpenSearchException> exception) {
+ return OpenSearchExceptionHandleRegistry.getId(exception);
}
/**
@@ -383,906 +1545,15 @@ public static T writeStackTraces(T throwable, StreamOutput
* in id order below. If you want to remove an exception leave a tombstone comment and mark the id as null in
* ExceptionSerializationTests.testIds.ids.
*/
- private enum OpenSearchExceptionHandle {
- INDEX_SHARD_SNAPSHOT_FAILED_EXCEPTION(
- org.opensearch.index.snapshots.IndexShardSnapshotFailedException.class,
- org.opensearch.index.snapshots.IndexShardSnapshotFailedException::new,
- 0,
- UNKNOWN_VERSION_ADDED
- ),
- DFS_PHASE_EXECUTION_EXCEPTION(
- org.opensearch.search.dfs.DfsPhaseExecutionException.class,
- org.opensearch.search.dfs.DfsPhaseExecutionException::new,
- 1,
- UNKNOWN_VERSION_ADDED
- ),
- EXECUTION_CANCELLED_EXCEPTION(
- org.opensearch.common.util.CancellableThreads.ExecutionCancelledException.class,
- org.opensearch.common.util.CancellableThreads.ExecutionCancelledException::new,
- 2,
- UNKNOWN_VERSION_ADDED
- ),
- CLUSTER_MANAGER_NOT_DISCOVERED_EXCEPTION(
- org.opensearch.discovery.ClusterManagerNotDiscoveredException.class,
- org.opensearch.discovery.ClusterManagerNotDiscoveredException::new,
- 3,
- UNKNOWN_VERSION_ADDED
- ),
- OPENSEARCH_SECURITY_EXCEPTION(
- org.opensearch.OpenSearchSecurityException.class,
- org.opensearch.OpenSearchSecurityException::new,
- 4,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_RESTORE_EXCEPTION(
- org.opensearch.index.snapshots.IndexShardRestoreException.class,
- org.opensearch.index.snapshots.IndexShardRestoreException::new,
- 5,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_CLOSED_EXCEPTION(
- org.opensearch.indices.IndexClosedException.class,
- org.opensearch.indices.IndexClosedException::new,
- 6,
- UNKNOWN_VERSION_ADDED
- ),
- BIND_HTTP_EXCEPTION(
- org.opensearch.http.BindHttpException.class,
- org.opensearch.http.BindHttpException::new,
- 7,
- UNKNOWN_VERSION_ADDED
- ),
- REDUCE_SEARCH_PHASE_EXCEPTION(
- org.opensearch.action.search.ReduceSearchPhaseException.class,
- org.opensearch.action.search.ReduceSearchPhaseException::new,
- 8,
- UNKNOWN_VERSION_ADDED
- ),
- NODE_CLOSED_EXCEPTION(
- org.opensearch.node.NodeClosedException.class,
- org.opensearch.node.NodeClosedException::new,
- 9,
- UNKNOWN_VERSION_ADDED
- ),
- SNAPSHOT_FAILED_ENGINE_EXCEPTION(
- org.opensearch.index.engine.SnapshotFailedEngineException.class,
- org.opensearch.index.engine.SnapshotFailedEngineException::new,
- 10,
- UNKNOWN_VERSION_ADDED
- ),
- SHARD_NOT_FOUND_EXCEPTION(
- org.opensearch.index.shard.ShardNotFoundException.class,
- org.opensearch.index.shard.ShardNotFoundException::new,
- 11,
- UNKNOWN_VERSION_ADDED
- ),
- CONNECT_TRANSPORT_EXCEPTION(
- org.opensearch.transport.ConnectTransportException.class,
- org.opensearch.transport.ConnectTransportException::new,
- 12,
- UNKNOWN_VERSION_ADDED
- ),
- NOT_SERIALIZABLE_TRANSPORT_EXCEPTION(
- org.opensearch.transport.NotSerializableTransportException.class,
- org.opensearch.transport.NotSerializableTransportException::new,
- 13,
- UNKNOWN_VERSION_ADDED
- ),
- RESPONSE_HANDLER_FAILURE_TRANSPORT_EXCEPTION(
- org.opensearch.transport.ResponseHandlerFailureTransportException.class,
- org.opensearch.transport.ResponseHandlerFailureTransportException::new,
- 14,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_CREATION_EXCEPTION(
- org.opensearch.indices.IndexCreationException.class,
- org.opensearch.indices.IndexCreationException::new,
- 15,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_NOT_FOUND_EXCEPTION(
- org.opensearch.index.IndexNotFoundException.class,
- org.opensearch.index.IndexNotFoundException::new,
- 16,
- UNKNOWN_VERSION_ADDED
- ),
- ILLEGAL_SHARD_ROUTING_STATE_EXCEPTION(
- org.opensearch.cluster.routing.IllegalShardRoutingStateException.class,
- org.opensearch.cluster.routing.IllegalShardRoutingStateException::new,
- 17,
- UNKNOWN_VERSION_ADDED
- ),
- BROADCAST_SHARD_OPERATION_FAILED_EXCEPTION(
- org.opensearch.action.support.broadcast.BroadcastShardOperationFailedException.class,
- org.opensearch.action.support.broadcast.BroadcastShardOperationFailedException::new,
- 18,
- UNKNOWN_VERSION_ADDED
- ),
- RESOURCE_NOT_FOUND_EXCEPTION(
- org.opensearch.ResourceNotFoundException.class,
- org.opensearch.ResourceNotFoundException::new,
- 19,
- UNKNOWN_VERSION_ADDED
- ),
- ACTION_TRANSPORT_EXCEPTION(
- org.opensearch.transport.ActionTransportException.class,
- org.opensearch.transport.ActionTransportException::new,
- 20,
- UNKNOWN_VERSION_ADDED
- ),
- OPENSEARCH_GENERATION_EXCEPTION(
- org.opensearch.OpenSearchGenerationException.class,
- org.opensearch.OpenSearchGenerationException::new,
- 21,
- UNKNOWN_VERSION_ADDED
- ),
- // 22 was CreateFailedEngineException
- INDEX_SHARD_STARTED_EXCEPTION(
- org.opensearch.index.shard.IndexShardStartedException.class,
- org.opensearch.index.shard.IndexShardStartedException::new,
- 23,
- UNKNOWN_VERSION_ADDED
- ),
- SEARCH_CONTEXT_MISSING_EXCEPTION(
- org.opensearch.search.SearchContextMissingException.class,
- org.opensearch.search.SearchContextMissingException::new,
- 24,
- UNKNOWN_VERSION_ADDED
- ),
- GENERAL_SCRIPT_EXCEPTION(
- org.opensearch.script.GeneralScriptException.class,
- org.opensearch.script.GeneralScriptException::new,
- 25,
- UNKNOWN_VERSION_ADDED
- ),
- // 26 was BatchOperationException
- SNAPSHOT_CREATION_EXCEPTION(
- org.opensearch.snapshots.SnapshotCreationException.class,
- org.opensearch.snapshots.SnapshotCreationException::new,
- 27,
- UNKNOWN_VERSION_ADDED
- ),
- // 28 was DeleteFailedEngineException, deprecated in 6.0, removed in 7.0
- DOCUMENT_MISSING_EXCEPTION(
- org.opensearch.index.engine.DocumentMissingException.class,
- org.opensearch.index.engine.DocumentMissingException::new,
- 29,
- UNKNOWN_VERSION_ADDED
- ),
- SNAPSHOT_EXCEPTION(
- org.opensearch.snapshots.SnapshotException.class,
- org.opensearch.snapshots.SnapshotException::new,
- 30,
- UNKNOWN_VERSION_ADDED
- ),
- INVALID_ALIAS_NAME_EXCEPTION(
- org.opensearch.indices.InvalidAliasNameException.class,
- org.opensearch.indices.InvalidAliasNameException::new,
- 31,
- UNKNOWN_VERSION_ADDED
- ),
- INVALID_INDEX_NAME_EXCEPTION(
- org.opensearch.indices.InvalidIndexNameException.class,
- org.opensearch.indices.InvalidIndexNameException::new,
- 32,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_PRIMARY_SHARD_NOT_ALLOCATED_EXCEPTION(
- org.opensearch.indices.IndexPrimaryShardNotAllocatedException.class,
- org.opensearch.indices.IndexPrimaryShardNotAllocatedException::new,
- 33,
- UNKNOWN_VERSION_ADDED
- ),
- TRANSPORT_EXCEPTION(
- org.opensearch.transport.TransportException.class,
- org.opensearch.transport.TransportException::new,
- 34,
- UNKNOWN_VERSION_ADDED
- ),
- OPENSEARCH_PARSE_EXCEPTION(
- org.opensearch.OpenSearchParseException.class,
- org.opensearch.OpenSearchParseException::new,
- 35,
- UNKNOWN_VERSION_ADDED
- ),
- SEARCH_EXCEPTION(
- org.opensearch.search.SearchException.class,
- org.opensearch.search.SearchException::new,
- 36,
- UNKNOWN_VERSION_ADDED
- ),
- MAPPER_EXCEPTION(
- org.opensearch.index.mapper.MapperException.class,
- org.opensearch.index.mapper.MapperException::new,
- 37,
- UNKNOWN_VERSION_ADDED
- ),
- INVALID_TYPE_NAME_EXCEPTION(
- org.opensearch.indices.InvalidTypeNameException.class,
- org.opensearch.indices.InvalidTypeNameException::new,
- 38,
- UNKNOWN_VERSION_ADDED
- ),
- SNAPSHOT_RESTORE_EXCEPTION(
- org.opensearch.snapshots.SnapshotRestoreException.class,
- org.opensearch.snapshots.SnapshotRestoreException::new,
- 39,
- UNKNOWN_VERSION_ADDED
- ),
- PARSING_EXCEPTION(
- org.opensearch.common.ParsingException.class,
- org.opensearch.common.ParsingException::new,
- 40,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_CLOSED_EXCEPTION(
- org.opensearch.index.shard.IndexShardClosedException.class,
- org.opensearch.index.shard.IndexShardClosedException::new,
- 41,
- UNKNOWN_VERSION_ADDED
- ),
- RECOVER_FILES_RECOVERY_EXCEPTION(
- org.opensearch.indices.recovery.RecoverFilesRecoveryException.class,
- org.opensearch.indices.recovery.RecoverFilesRecoveryException::new,
- 42,
- UNKNOWN_VERSION_ADDED
- ),
- TRUNCATED_TRANSLOG_EXCEPTION(
- org.opensearch.index.translog.TruncatedTranslogException.class,
- org.opensearch.index.translog.TruncatedTranslogException::new,
- 43,
- UNKNOWN_VERSION_ADDED
- ),
- RECOVERY_FAILED_EXCEPTION(
- org.opensearch.indices.recovery.RecoveryFailedException.class,
- org.opensearch.indices.recovery.RecoveryFailedException::new,
- 44,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_RELOCATED_EXCEPTION(
- org.opensearch.index.shard.IndexShardRelocatedException.class,
- org.opensearch.index.shard.IndexShardRelocatedException::new,
- 45,
- UNKNOWN_VERSION_ADDED
- ),
- NODE_SHOULD_NOT_CONNECT_EXCEPTION(
- org.opensearch.transport.NodeShouldNotConnectException.class,
- org.opensearch.transport.NodeShouldNotConnectException::new,
- 46,
- UNKNOWN_VERSION_ADDED
- ),
- // 47 used to be for IndexTemplateAlreadyExistsException which was deprecated in 5.1 removed in 6.0
- TRANSLOG_CORRUPTED_EXCEPTION(
- org.opensearch.index.translog.TranslogCorruptedException.class,
- org.opensearch.index.translog.TranslogCorruptedException::new,
- 48,
- UNKNOWN_VERSION_ADDED
- ),
- CLUSTER_BLOCK_EXCEPTION(
- org.opensearch.cluster.block.ClusterBlockException.class,
- org.opensearch.cluster.block.ClusterBlockException::new,
- 49,
- UNKNOWN_VERSION_ADDED
- ),
- FETCH_PHASE_EXECUTION_EXCEPTION(
- org.opensearch.search.fetch.FetchPhaseExecutionException.class,
- org.opensearch.search.fetch.FetchPhaseExecutionException::new,
- 50,
- UNKNOWN_VERSION_ADDED
- ),
- // 51 used to be for IndexShardAlreadyExistsException which was deprecated in 5.1 removed in 6.0
- VERSION_CONFLICT_ENGINE_EXCEPTION(
- org.opensearch.index.engine.VersionConflictEngineException.class,
- org.opensearch.index.engine.VersionConflictEngineException::new,
- 52,
- UNKNOWN_VERSION_ADDED
- ),
- ENGINE_EXCEPTION(
- org.opensearch.index.engine.EngineException.class,
- org.opensearch.index.engine.EngineException::new,
- 53,
- UNKNOWN_VERSION_ADDED
- ),
- // 54 was DocumentAlreadyExistsException, which is superseded by VersionConflictEngineException
- NO_SUCH_NODE_EXCEPTION(
- org.opensearch.action.NoSuchNodeException.class,
- org.opensearch.action.NoSuchNodeException::new,
- 55,
- UNKNOWN_VERSION_ADDED
- ),
- SETTINGS_EXCEPTION(
- org.opensearch.common.settings.SettingsException.class,
- org.opensearch.common.settings.SettingsException::new,
- 56,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_TEMPLATE_MISSING_EXCEPTION(
- org.opensearch.indices.IndexTemplateMissingException.class,
- org.opensearch.indices.IndexTemplateMissingException::new,
- 57,
- UNKNOWN_VERSION_ADDED
- ),
- SEND_REQUEST_TRANSPORT_EXCEPTION(
- org.opensearch.transport.SendRequestTransportException.class,
- org.opensearch.transport.SendRequestTransportException::new,
- 58,
- UNKNOWN_VERSION_ADDED
- ),
- // 59 used to be OpenSearchRejectedExecutionException
- // 60 used to be for EarlyTerminationException
- // 61 used to be for RoutingValidationException
- NOT_SERIALIZABLE_EXCEPTION_WRAPPER(
- org.opensearch.common.io.stream.NotSerializableExceptionWrapper.class,
- org.opensearch.common.io.stream.NotSerializableExceptionWrapper::new,
- 62,
- UNKNOWN_VERSION_ADDED
- ),
- ALIAS_FILTER_PARSING_EXCEPTION(
- org.opensearch.indices.AliasFilterParsingException.class,
- org.opensearch.indices.AliasFilterParsingException::new,
- 63,
- UNKNOWN_VERSION_ADDED
- ),
- // 64 was DeleteByQueryFailedEngineException, which was removed in 5.0
- GATEWAY_EXCEPTION(
- org.opensearch.gateway.GatewayException.class,
- org.opensearch.gateway.GatewayException::new,
- 65,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_NOT_RECOVERING_EXCEPTION(
- org.opensearch.index.shard.IndexShardNotRecoveringException.class,
- org.opensearch.index.shard.IndexShardNotRecoveringException::new,
- 66,
- UNKNOWN_VERSION_ADDED
- ),
- HTTP_EXCEPTION(org.opensearch.http.HttpException.class, org.opensearch.http.HttpException::new, 67, UNKNOWN_VERSION_ADDED),
- OPENSEARCH_EXCEPTION(OpenSearchException.class, OpenSearchException::new, 68, UNKNOWN_VERSION_ADDED),
- SNAPSHOT_MISSING_EXCEPTION(
- org.opensearch.snapshots.SnapshotMissingException.class,
- org.opensearch.snapshots.SnapshotMissingException::new,
- 69,
- UNKNOWN_VERSION_ADDED
- ),
- PRIMARY_MISSING_ACTION_EXCEPTION(
- org.opensearch.action.PrimaryMissingActionException.class,
- org.opensearch.action.PrimaryMissingActionException::new,
- 70,
- UNKNOWN_VERSION_ADDED
- ),
- FAILED_NODE_EXCEPTION(
- org.opensearch.action.FailedNodeException.class,
- org.opensearch.action.FailedNodeException::new,
- 71,
- UNKNOWN_VERSION_ADDED
- ),
- SEARCH_PARSE_EXCEPTION(
- org.opensearch.search.SearchParseException.class,
- org.opensearch.search.SearchParseException::new,
- 72,
- UNKNOWN_VERSION_ADDED
- ),
- CONCURRENT_SNAPSHOT_EXECUTION_EXCEPTION(
- org.opensearch.snapshots.ConcurrentSnapshotExecutionException.class,
- org.opensearch.snapshots.ConcurrentSnapshotExecutionException::new,
- 73,
- UNKNOWN_VERSION_ADDED
- ),
- BLOB_STORE_EXCEPTION(
- org.opensearch.common.blobstore.BlobStoreException.class,
- org.opensearch.common.blobstore.BlobStoreException::new,
- 74,
- UNKNOWN_VERSION_ADDED
- ),
- INCOMPATIBLE_CLUSTER_STATE_VERSION_EXCEPTION(
- org.opensearch.cluster.IncompatibleClusterStateVersionException.class,
- org.opensearch.cluster.IncompatibleClusterStateVersionException::new,
- 75,
- UNKNOWN_VERSION_ADDED
- ),
- RECOVERY_ENGINE_EXCEPTION(
- org.opensearch.index.engine.RecoveryEngineException.class,
- org.opensearch.index.engine.RecoveryEngineException::new,
- 76,
- UNKNOWN_VERSION_ADDED
- ),
- UNCATEGORIZED_EXECUTION_EXCEPTION(
- org.opensearch.common.util.concurrent.UncategorizedExecutionException.class,
- org.opensearch.common.util.concurrent.UncategorizedExecutionException::new,
- 77,
- UNKNOWN_VERSION_ADDED
- ),
- TIMESTAMP_PARSING_EXCEPTION(
- org.opensearch.action.TimestampParsingException.class,
- org.opensearch.action.TimestampParsingException::new,
- 78,
- UNKNOWN_VERSION_ADDED
- ),
- ROUTING_MISSING_EXCEPTION(
- org.opensearch.action.RoutingMissingException.class,
- org.opensearch.action.RoutingMissingException::new,
- 79,
- UNKNOWN_VERSION_ADDED
- ),
- // 80 was IndexFailedEngineException, deprecated in 6.0, removed in 7.0
- INDEX_SHARD_RESTORE_FAILED_EXCEPTION(
- org.opensearch.index.snapshots.IndexShardRestoreFailedException.class,
- org.opensearch.index.snapshots.IndexShardRestoreFailedException::new,
- 81,
- UNKNOWN_VERSION_ADDED
- ),
- REPOSITORY_EXCEPTION(
- org.opensearch.repositories.RepositoryException.class,
- org.opensearch.repositories.RepositoryException::new,
- 82,
- UNKNOWN_VERSION_ADDED
- ),
- RECEIVE_TIMEOUT_TRANSPORT_EXCEPTION(
- org.opensearch.transport.ReceiveTimeoutTransportException.class,
- org.opensearch.transport.ReceiveTimeoutTransportException::new,
- 83,
- UNKNOWN_VERSION_ADDED
- ),
- NODE_DISCONNECTED_EXCEPTION(
- org.opensearch.transport.NodeDisconnectedException.class,
- org.opensearch.transport.NodeDisconnectedException::new,
- 84,
- UNKNOWN_VERSION_ADDED
- ),
- // 85 used to be for AlreadyExpiredException
- AGGREGATION_EXECUTION_EXCEPTION(
- org.opensearch.search.aggregations.AggregationExecutionException.class,
- org.opensearch.search.aggregations.AggregationExecutionException::new,
- 86,
- UNKNOWN_VERSION_ADDED
- ),
- // 87 used to be for MergeMappingException
- INVALID_INDEX_TEMPLATE_EXCEPTION(
- org.opensearch.indices.InvalidIndexTemplateException.class,
- org.opensearch.indices.InvalidIndexTemplateException::new,
- 88,
- UNKNOWN_VERSION_ADDED
- ),
- REFRESH_FAILED_ENGINE_EXCEPTION(
- org.opensearch.index.engine.RefreshFailedEngineException.class,
- org.opensearch.index.engine.RefreshFailedEngineException::new,
- 90,
- UNKNOWN_VERSION_ADDED
- ),
- AGGREGATION_INITIALIZATION_EXCEPTION(
- org.opensearch.search.aggregations.AggregationInitializationException.class,
- org.opensearch.search.aggregations.AggregationInitializationException::new,
- 91,
- UNKNOWN_VERSION_ADDED
- ),
- DELAY_RECOVERY_EXCEPTION(
- org.opensearch.indices.recovery.DelayRecoveryException.class,
- org.opensearch.indices.recovery.DelayRecoveryException::new,
- 92,
- UNKNOWN_VERSION_ADDED
- ),
- // 93 used to be for IndexWarmerMissingException
- NO_NODE_AVAILABLE_EXCEPTION(
- org.opensearch.client.transport.NoNodeAvailableException.class,
- org.opensearch.client.transport.NoNodeAvailableException::new,
- 94,
- UNKNOWN_VERSION_ADDED
- ),
- INVALID_SNAPSHOT_NAME_EXCEPTION(
- org.opensearch.snapshots.InvalidSnapshotNameException.class,
- org.opensearch.snapshots.InvalidSnapshotNameException::new,
- 96,
- UNKNOWN_VERSION_ADDED
- ),
- ILLEGAL_INDEX_SHARD_STATE_EXCEPTION(
- org.opensearch.index.shard.IllegalIndexShardStateException.class,
- org.opensearch.index.shard.IllegalIndexShardStateException::new,
- 97,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_SNAPSHOT_EXCEPTION(
- org.opensearch.index.snapshots.IndexShardSnapshotException.class,
- org.opensearch.index.snapshots.IndexShardSnapshotException::new,
- 98,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_NOT_STARTED_EXCEPTION(
- org.opensearch.index.shard.IndexShardNotStartedException.class,
- org.opensearch.index.shard.IndexShardNotStartedException::new,
- 99,
- UNKNOWN_VERSION_ADDED
- ),
- SEARCH_PHASE_EXECUTION_EXCEPTION(
- org.opensearch.action.search.SearchPhaseExecutionException.class,
- org.opensearch.action.search.SearchPhaseExecutionException::new,
- 100,
- UNKNOWN_VERSION_ADDED
- ),
- ACTION_NOT_FOUND_TRANSPORT_EXCEPTION(
- org.opensearch.transport.ActionNotFoundTransportException.class,
- org.opensearch.transport.ActionNotFoundTransportException::new,
- 101,
- UNKNOWN_VERSION_ADDED
- ),
- TRANSPORT_SERIALIZATION_EXCEPTION(
- org.opensearch.transport.TransportSerializationException.class,
- org.opensearch.transport.TransportSerializationException::new,
- 102,
- UNKNOWN_VERSION_ADDED
- ),
- REMOTE_TRANSPORT_EXCEPTION(
- org.opensearch.transport.RemoteTransportException.class,
- org.opensearch.transport.RemoteTransportException::new,
- 103,
- UNKNOWN_VERSION_ADDED
- ),
- ENGINE_CREATION_FAILURE_EXCEPTION(
- org.opensearch.index.engine.EngineCreationFailureException.class,
- org.opensearch.index.engine.EngineCreationFailureException::new,
- 104,
- UNKNOWN_VERSION_ADDED
- ),
- ROUTING_EXCEPTION(
- org.opensearch.cluster.routing.RoutingException.class,
- org.opensearch.cluster.routing.RoutingException::new,
- 105,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_RECOVERY_EXCEPTION(
- org.opensearch.index.shard.IndexShardRecoveryException.class,
- org.opensearch.index.shard.IndexShardRecoveryException::new,
- 106,
- UNKNOWN_VERSION_ADDED
- ),
- REPOSITORY_MISSING_EXCEPTION(
- org.opensearch.repositories.RepositoryMissingException.class,
- org.opensearch.repositories.RepositoryMissingException::new,
- 107,
- UNKNOWN_VERSION_ADDED
- ),
- DOCUMENT_SOURCE_MISSING_EXCEPTION(
- org.opensearch.index.engine.DocumentSourceMissingException.class,
- org.opensearch.index.engine.DocumentSourceMissingException::new,
- 109,
- UNKNOWN_VERSION_ADDED
- ),
- // 110 used to be FlushNotAllowedEngineException
- NO_CLASS_SETTINGS_EXCEPTION(
- org.opensearch.common.settings.NoClassSettingsException.class,
- org.opensearch.common.settings.NoClassSettingsException::new,
- 111,
- UNKNOWN_VERSION_ADDED
- ),
- BIND_TRANSPORT_EXCEPTION(
- org.opensearch.transport.BindTransportException.class,
- org.opensearch.transport.BindTransportException::new,
- 112,
- UNKNOWN_VERSION_ADDED
- ),
- ALIASES_NOT_FOUND_EXCEPTION(
- org.opensearch.rest.action.admin.indices.AliasesNotFoundException.class,
- org.opensearch.rest.action.admin.indices.AliasesNotFoundException::new,
- 113,
- UNKNOWN_VERSION_ADDED
- ),
- INDEX_SHARD_RECOVERING_EXCEPTION(
- org.opensearch.index.shard.IndexShardRecoveringException.class,
- org.opensearch.index.shard.IndexShardRecoveringException::new,
- 114,
- UNKNOWN_VERSION_ADDED
- ),
- TRANSLOG_EXCEPTION(
- org.opensearch.index.translog.TranslogException.class,
- org.opensearch.index.translog.TranslogException::new,
- 115,
- UNKNOWN_VERSION_ADDED
- ),
- PROCESS_CLUSTER_EVENT_TIMEOUT_EXCEPTION(
- org.opensearch.cluster.metadata.ProcessClusterEventTimeoutException.class,
- org.opensearch.cluster.metadata.ProcessClusterEventTimeoutException::new,
- 116,
- UNKNOWN_VERSION_ADDED
- ),
- RETRY_ON_PRIMARY_EXCEPTION(
- ReplicationOperation.RetryOnPrimaryException.class,
- ReplicationOperation.RetryOnPrimaryException::new,
- 117,
- UNKNOWN_VERSION_ADDED
- ),
- OPENSEARCH_TIMEOUT_EXCEPTION(
- org.opensearch.OpenSearchTimeoutException.class,
- org.opensearch.OpenSearchTimeoutException::new,
- 118,
- UNKNOWN_VERSION_ADDED
- ),
- QUERY_PHASE_EXECUTION_EXCEPTION(
- org.opensearch.search.query.QueryPhaseExecutionException.class,
- org.opensearch.search.query.QueryPhaseExecutionException::new,
- 119,
- UNKNOWN_VERSION_ADDED
- ),
- REPOSITORY_VERIFICATION_EXCEPTION(
- org.opensearch.repositories.RepositoryVerificationException.class,
- org.opensearch.repositories.RepositoryVerificationException::new,
- 120,
- UNKNOWN_VERSION_ADDED
- ),
- INVALID_AGGREGATION_PATH_EXCEPTION(
- org.opensearch.search.aggregations.InvalidAggregationPathException.class,
- org.opensearch.search.aggregations.InvalidAggregationPathException::new,
- 121,
- UNKNOWN_VERSION_ADDED
- ),
- // 123 used to be IndexAlreadyExistsException and was renamed
- RESOURCE_ALREADY_EXISTS_EXCEPTION(
- ResourceAlreadyExistsException.class,
- ResourceAlreadyExistsException::new,
- 123,
- UNKNOWN_VERSION_ADDED
- ),
- // 124 used to be Script.ScriptParseException
- HTTP_REQUEST_ON_TRANSPORT_EXCEPTION(
- TcpTransport.HttpRequestOnTransportException.class,
- TcpTransport.HttpRequestOnTransportException::new,
- 125,
- UNKNOWN_VERSION_ADDED
- ),
- MAPPER_PARSING_EXCEPTION(
- org.opensearch.index.mapper.MapperParsingException.class,
- org.opensearch.index.mapper.MapperParsingException::new,
- 126,
- UNKNOWN_VERSION_ADDED
- ),
- // 127 used to be org.opensearch.search.SearchContextException
- SEARCH_SOURCE_BUILDER_EXCEPTION(
- org.opensearch.search.builder.SearchSourceBuilderException.class,
- org.opensearch.search.builder.SearchSourceBuilderException::new,
- 128,
- UNKNOWN_VERSION_ADDED
- ),
- // 129 was EngineClosedException
- NO_SHARD_AVAILABLE_ACTION_EXCEPTION(
- org.opensearch.action.NoShardAvailableActionException.class,
- org.opensearch.action.NoShardAvailableActionException::new,
- 130,
- UNKNOWN_VERSION_ADDED
- ),
- UNAVAILABLE_SHARDS_EXCEPTION(
- org.opensearch.action.UnavailableShardsException.class,
- org.opensearch.action.UnavailableShardsException::new,
- 131,
- UNKNOWN_VERSION_ADDED
- ),
- FLUSH_FAILED_ENGINE_EXCEPTION(
- org.opensearch.index.engine.FlushFailedEngineException.class,
- org.opensearch.index.engine.FlushFailedEngineException::new,
- 132,
- UNKNOWN_VERSION_ADDED
- ),
- CIRCUIT_BREAKING_EXCEPTION(
- org.opensearch.common.breaker.CircuitBreakingException.class,
- org.opensearch.common.breaker.CircuitBreakingException::new,
- 133,
- UNKNOWN_VERSION_ADDED
- ),
- NODE_NOT_CONNECTED_EXCEPTION(
- org.opensearch.transport.NodeNotConnectedException.class,
- org.opensearch.transport.NodeNotConnectedException::new,
- 134,
- UNKNOWN_VERSION_ADDED
- ),
- STRICT_DYNAMIC_MAPPING_EXCEPTION(
- org.opensearch.index.mapper.StrictDynamicMappingException.class,
- org.opensearch.index.mapper.StrictDynamicMappingException::new,
- 135,
- UNKNOWN_VERSION_ADDED
- ),
- RETRY_ON_REPLICA_EXCEPTION(
- org.opensearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException.class,
- org.opensearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException::new,
- 136,
- UNKNOWN_VERSION_ADDED
- ),
- TYPE_MISSING_EXCEPTION(
- org.opensearch.indices.TypeMissingException.class,
- org.opensearch.indices.TypeMissingException::new,
- 137,
- UNKNOWN_VERSION_ADDED
- ),
- FAILED_TO_COMMIT_CLUSTER_STATE_EXCEPTION(
- org.opensearch.cluster.coordination.FailedToCommitClusterStateException.class,
- org.opensearch.cluster.coordination.FailedToCommitClusterStateException::new,
- 140,
- UNKNOWN_VERSION_ADDED
- ),
- QUERY_SHARD_EXCEPTION(
- org.opensearch.index.query.QueryShardException.class,
- org.opensearch.index.query.QueryShardException::new,
- 141,
- UNKNOWN_VERSION_ADDED
- ),
- NO_LONGER_PRIMARY_SHARD_EXCEPTION(
- ShardStateAction.NoLongerPrimaryShardException.class,
- ShardStateAction.NoLongerPrimaryShardException::new,
- 142,
- UNKNOWN_VERSION_ADDED
- ),
- SCRIPT_EXCEPTION(
- org.opensearch.script.ScriptException.class,
- org.opensearch.script.ScriptException::new,
- 143,
- UNKNOWN_VERSION_ADDED
- ),
- NOT_CLUSTER_MANAGER_EXCEPTION(
- org.opensearch.cluster.NotClusterManagerException.class,
- org.opensearch.cluster.NotClusterManagerException::new,
- 144,
- UNKNOWN_VERSION_ADDED
- ),
- STATUS_EXCEPTION(
- org.opensearch.OpenSearchStatusException.class,
- org.opensearch.OpenSearchStatusException::new,
- 145,
- UNKNOWN_VERSION_ADDED
- ),
- TASK_CANCELLED_EXCEPTION(
- org.opensearch.tasks.TaskCancelledException.class,
- org.opensearch.tasks.TaskCancelledException::new,
- 146,
- UNKNOWN_VERSION_ADDED
- ),
- SHARD_LOCK_OBTAIN_FAILED_EXCEPTION(
- org.opensearch.env.ShardLockObtainFailedException.class,
- org.opensearch.env.ShardLockObtainFailedException::new,
- 147,
- UNKNOWN_VERSION_ADDED
- ),
- // 148 was UnknownNamedObjectException
- TOO_MANY_BUCKETS_EXCEPTION(
- MultiBucketConsumerService.TooManyBucketsException.class,
- MultiBucketConsumerService.TooManyBucketsException::new,
- 149,
- UNKNOWN_VERSION_ADDED
- ),
- COORDINATION_STATE_REJECTED_EXCEPTION(
- org.opensearch.cluster.coordination.CoordinationStateRejectedException.class,
- org.opensearch.cluster.coordination.CoordinationStateRejectedException::new,
- 150,
- UNKNOWN_VERSION_ADDED
- ),
- SNAPSHOT_IN_PROGRESS_EXCEPTION(
- org.opensearch.snapshots.SnapshotInProgressException.class,
- org.opensearch.snapshots.SnapshotInProgressException::new,
- 151,
- UNKNOWN_VERSION_ADDED
- ),
- NO_SUCH_REMOTE_CLUSTER_EXCEPTION(
- org.opensearch.transport.NoSuchRemoteClusterException.class,
- org.opensearch.transport.NoSuchRemoteClusterException::new,
- 152,
- UNKNOWN_VERSION_ADDED
- ),
- RETENTION_LEASE_ALREADY_EXISTS_EXCEPTION(
- org.opensearch.index.seqno.RetentionLeaseAlreadyExistsException.class,
- org.opensearch.index.seqno.RetentionLeaseAlreadyExistsException::new,
- 153,
- UNKNOWN_VERSION_ADDED
- ),
- RETENTION_LEASE_NOT_FOUND_EXCEPTION(
- org.opensearch.index.seqno.RetentionLeaseNotFoundException.class,
- org.opensearch.index.seqno.RetentionLeaseNotFoundException::new,
- 154,
- UNKNOWN_VERSION_ADDED
- ),
- SHARD_NOT_IN_PRIMARY_MODE_EXCEPTION(
- org.opensearch.index.shard.ShardNotInPrimaryModeException.class,
- org.opensearch.index.shard.ShardNotInPrimaryModeException::new,
- 155,
- UNKNOWN_VERSION_ADDED
- ),
- RETENTION_LEASE_INVALID_RETAINING_SEQUENCE_NUMBER_EXCEPTION(
- org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException.class,
- org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException::new,
- 156,
- UNKNOWN_VERSION_ADDED
- ),
- INGEST_PROCESSOR_EXCEPTION(
- org.opensearch.ingest.IngestProcessorException.class,
- org.opensearch.ingest.IngestProcessorException::new,
- 157,
- UNKNOWN_VERSION_ADDED
- ),
- PEER_RECOVERY_NOT_FOUND_EXCEPTION(
- org.opensearch.indices.recovery.PeerRecoveryNotFound.class,
- org.opensearch.indices.recovery.PeerRecoveryNotFound::new,
- 158,
- UNKNOWN_VERSION_ADDED
- ),
- NODE_HEALTH_CHECK_FAILURE_EXCEPTION(
- org.opensearch.cluster.coordination.NodeHealthCheckFailureException.class,
- org.opensearch.cluster.coordination.NodeHealthCheckFailureException::new,
- 159,
- UNKNOWN_VERSION_ADDED
- ),
- NO_SEED_NODE_LEFT_EXCEPTION(
- org.opensearch.transport.NoSeedNodeLeftException.class,
- org.opensearch.transport.NoSeedNodeLeftException::new,
- 160,
- UNKNOWN_VERSION_ADDED
- ),
- REPLICATION_FAILED_EXCEPTION(
- org.opensearch.indices.replication.common.ReplicationFailedException.class,
- org.opensearch.indices.replication.common.ReplicationFailedException::new,
- 161,
- V_2_1_0
- ),
- PRIMARY_SHARD_CLOSED_EXCEPTION(
- org.opensearch.index.shard.PrimaryShardClosedException.class,
- org.opensearch.index.shard.PrimaryShardClosedException::new,
- 162,
- V_3_0_0
- ),
- DECOMMISSIONING_FAILED_EXCEPTION(
- org.opensearch.cluster.decommission.DecommissioningFailedException.class,
- org.opensearch.cluster.decommission.DecommissioningFailedException::new,
- 163,
- V_2_4_0
- ),
- NODE_DECOMMISSIONED_EXCEPTION(
- org.opensearch.cluster.decommission.NodeDecommissionedException.class,
- org.opensearch.cluster.decommission.NodeDecommissionedException::new,
- 164,
- V_3_0_0
- ),
- CLUSTER_MANAGER_TASK_THROTTLED_EXCEPTION(
- ClusterManagerThrottlingException.class,
- ClusterManagerThrottlingException::new,
- 165,
- Version.V_2_5_0
- ),
- SNAPSHOT_IN_USE_DELETION_EXCEPTION(
- SnapshotInUseDeletionException.class,
- SnapshotInUseDeletionException::new,
- 166,
- UNKNOWN_VERSION_ADDED
- ),
- UNSUPPORTED_WEIGHTED_ROUTING_STATE_EXCEPTION(
- UnsupportedWeightedRoutingStateException.class,
- UnsupportedWeightedRoutingStateException::new,
- 167,
- V_2_5_0
- ),
- PREFERENCE_BASED_SEARCH_NOT_ALLOWED_EXCEPTION(
- PreferenceBasedSearchNotAllowedException.class,
- PreferenceBasedSearchNotAllowedException::new,
- 168,
- V_2_6_0
- ),
- NODE_WEIGHED_AWAY_EXCEPTION(NodeWeighedAwayException.class, NodeWeighedAwayException::new, 169, V_2_6_0),
- SEARCH_PIPELINE_PROCESSING_EXCEPTION(SearchPipelineProcessingException.class, SearchPipelineProcessingException::new, 170, V_2_7_0),
- INDEX_CREATE_BLOCK_EXCEPTION(
- org.opensearch.cluster.block.IndexCreateBlockException.class,
- org.opensearch.cluster.block.IndexCreateBlockException::new,
- CUSTOM_ELASTICSEARCH_EXCEPTIONS_BASE_ID + 1,
- V_3_0_0
- );
-
- final Class extends OpenSearchException> exceptionClass;
- final CheckedFunction constructor;
- final int id;
- final Version versionAdded;
-
- OpenSearchExceptionHandle(
- Class exceptionClass,
- CheckedFunction constructor,
- int id,
- Version versionAdded
+ protected static class OpenSearchExceptionHandle extends BaseOpenSearchExceptionHandle {
+ OpenSearchExceptionHandle(
+ final Class exceptionClass,
+ final CheckedFunction constructor,
+ final int id,
+ final Version versionAdded
) {
- // We need the exceptionClass because you can't dig it out of the constructor reliably.
- this.exceptionClass = exceptionClass;
- this.constructor = constructor;
- this.versionAdded = versionAdded;
- this.id = id;
+ super(exceptionClass, constructor, id, versionAdded);
+ OpenSearchExceptionHandleRegistry.registerExceptionHandle(this);
}
}
@@ -1293,7 +1564,7 @@ OpenSearchExceptionHandle(
* @return an array of all registered handle IDs
*/
static int[] ids() {
- return Arrays.stream(OpenSearchExceptionHandle.values()).mapToInt(h -> h.id).toArray();
+ return OpenSearchExceptionHandleRegistry.ids().stream().mapToInt(i -> i).toArray();
}
/**
@@ -1302,23 +1573,14 @@ static int[] ids() {
*
* @return an array of all registered pairs of handle IDs and exception classes
*/
- static Tuple>[] classes() {
- @SuppressWarnings("unchecked")
- final Tuple>[] ts = Arrays.stream(OpenSearchExceptionHandle.values())
+ static Tuple>[] classes() {
+ final Tuple>[] ts = OpenSearchExceptionHandleRegistry.handles()
+ .stream()
.map(h -> Tuple.tuple(h.id, h.exceptionClass))
.toArray(Tuple[]::new);
return ts;
}
- static {
- ID_TO_SUPPLIER = unmodifiableMap(
- Arrays.stream(OpenSearchExceptionHandle.values()).collect(Collectors.toMap(e -> e.id, e -> e.constructor))
- );
- CLASS_TO_OPENSEARCH_EXCEPTION_HANDLE = unmodifiableMap(
- Arrays.stream(OpenSearchExceptionHandle.values()).collect(Collectors.toMap(e -> e.exceptionClass, e -> e))
- );
- }
-
public Index getIndex() {
List index = getMetadata(INDEX_METADATA_KEY);
if (index != null && index.isEmpty() == false) {
diff --git a/server/src/main/java/org/opensearch/action/admin/indices/close/TransportVerifyShardBeforeCloseAction.java b/server/src/main/java/org/opensearch/action/admin/indices/close/TransportVerifyShardBeforeCloseAction.java
index 691b2c7c95730..165169e36bf8d 100644
--- a/server/src/main/java/org/opensearch/action/admin/indices/close/TransportVerifyShardBeforeCloseAction.java
+++ b/server/src/main/java/org/opensearch/action/admin/indices/close/TransportVerifyShardBeforeCloseAction.java
@@ -47,8 +47,8 @@
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.IndicesService;
diff --git a/server/src/main/java/org/opensearch/action/admin/indices/readonly/TransportVerifyShardIndexBlockAction.java b/server/src/main/java/org/opensearch/action/admin/indices/readonly/TransportVerifyShardIndexBlockAction.java
index 11b5b86823a28..af5c26702c8b8 100644
--- a/server/src/main/java/org/opensearch/action/admin/indices/readonly/TransportVerifyShardIndexBlockAction.java
+++ b/server/src/main/java/org/opensearch/action/admin/indices/readonly/TransportVerifyShardIndexBlockAction.java
@@ -47,8 +47,8 @@
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.IndicesService;
diff --git a/server/src/main/java/org/opensearch/action/admin/indices/validate/query/TransportValidateQueryAction.java b/server/src/main/java/org/opensearch/action/admin/indices/validate/query/TransportValidateQueryAction.java
index 431c5468d1850..ab886d476e7f4 100644
--- a/server/src/main/java/org/opensearch/action/admin/indices/validate/query/TransportValidateQueryAction.java
+++ b/server/src/main/java/org/opensearch/action/admin/indices/validate/query/TransportValidateQueryAction.java
@@ -50,7 +50,7 @@
import org.opensearch.common.Randomness;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexNotFoundException;
import org.opensearch.index.query.ParsedQuery;
import org.opensearch.index.query.QueryShardException;
diff --git a/server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java b/server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java
index 830570dcbd134..51f347d6c1532 100644
--- a/server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java
+++ b/server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java
@@ -69,9 +69,9 @@
import org.opensearch.cluster.metadata.Metadata;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AtomicArray;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexNotFoundException;
import org.opensearch.index.IndexingPressureService;
diff --git a/server/src/main/java/org/opensearch/action/bulk/TransportShardBulkAction.java b/server/src/main/java/org/opensearch/action/bulk/TransportShardBulkAction.java
index 9e6b1bd59b386..f9b91ac70355e 100644
--- a/server/src/main/java/org/opensearch/action/bulk/TransportShardBulkAction.java
+++ b/server/src/main/java/org/opensearch/action/bulk/TransportShardBulkAction.java
@@ -73,14 +73,14 @@
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.common.util.concurrent.AbstractRunnable;
-import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.index.IndexingPressureService;
import org.opensearch.index.SegmentReplicationPressureService;
import org.opensearch.index.engine.Engine;
diff --git a/server/src/main/java/org/opensearch/action/explain/TransportExplainAction.java b/server/src/main/java/org/opensearch/action/explain/TransportExplainAction.java
index 5752860af4f16..a54ea389d1c20 100644
--- a/server/src/main/java/org/opensearch/action/explain/TransportExplainAction.java
+++ b/server/src/main/java/org/opensearch/action/explain/TransportExplainAction.java
@@ -45,7 +45,7 @@
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexService;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.get.GetResult;
diff --git a/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java b/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
index 43cf4c4e8dc79..c2dd5f639db75 100644
--- a/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
+++ b/server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java
@@ -46,10 +46,10 @@
import org.opensearch.cluster.routing.GroupShardsIterator;
import org.opensearch.common.Nullable;
import org.opensearch.common.SetOnce;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.AtomicArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.shard.ShardId;
import org.opensearch.search.SearchPhaseResult;
import org.opensearch.search.SearchShardTarget;
diff --git a/server/src/main/java/org/opensearch/action/search/CanMatchPreFilterSearchPhase.java b/server/src/main/java/org/opensearch/action/search/CanMatchPreFilterSearchPhase.java
index ec4d45a0a7124..9694695e4fbbb 100644
--- a/server/src/main/java/org/opensearch/action/search/CanMatchPreFilterSearchPhase.java
+++ b/server/src/main/java/org/opensearch/action/search/CanMatchPreFilterSearchPhase.java
@@ -36,7 +36,7 @@
import org.opensearch.action.ActionListener;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.routing.GroupShardsIterator;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.SearchService.CanMatchResponse;
import org.opensearch.search.SearchShardTarget;
import org.opensearch.search.builder.SearchSourceBuilder;
diff --git a/server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java b/server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java
index d3d3dbc8426f1..6698f33ea6ab7 100644
--- a/server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java
+++ b/server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java
@@ -38,10 +38,10 @@
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.breaker.CircuitBreakingException;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.search.TopDocsAndMaxScore;
import org.opensearch.common.util.concurrent.AbstractRunnable;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.SearchPhaseResult;
import org.opensearch.search.SearchShardTarget;
import org.opensearch.search.aggregations.InternalAggregation.ReduceContextBuilder;
diff --git a/server/src/main/java/org/opensearch/action/search/SearchPhaseContext.java b/server/src/main/java/org/opensearch/action/search/SearchPhaseContext.java
index be364fbcb9c84..04d0dab088d35 100644
--- a/server/src/main/java/org/opensearch/action/search/SearchPhaseContext.java
+++ b/server/src/main/java/org/opensearch/action/search/SearchPhaseContext.java
@@ -34,8 +34,8 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.OriginalIndices;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AtomicArray;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.SearchPhaseResult;
import org.opensearch.search.SearchShardTarget;
import org.opensearch.search.internal.InternalSearchResponse;
diff --git a/server/src/main/java/org/opensearch/action/support/TransportAction.java b/server/src/main/java/org/opensearch/action/support/TransportAction.java
index 71ae187b48c4e..7c2b68d972fc1 100644
--- a/server/src/main/java/org/opensearch/action/support/TransportAction.java
+++ b/server/src/main/java/org/opensearch/action/support/TransportAction.java
@@ -38,9 +38,9 @@
import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.ActionResponse;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.tasks.Task;
import org.opensearch.tasks.TaskCancelledException;
import org.opensearch.tasks.TaskId;
diff --git a/server/src/main/java/org/opensearch/action/support/replication/PendingReplicationActions.java b/server/src/main/java/org/opensearch/action/support/replication/PendingReplicationActions.java
index 7087b64758888..744962a735d74 100644
--- a/server/src/main/java/org/opensearch/action/support/replication/PendingReplicationActions.java
+++ b/server/src/main/java/org/opensearch/action/support/replication/PendingReplicationActions.java
@@ -33,8 +33,8 @@
package org.opensearch.action.support.replication;
import org.opensearch.action.support.RetryableAction;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.PrimaryShardClosedException;
import org.opensearch.index.shard.IndexShardClosedException;
import org.opensearch.index.shard.ReplicationGroup;
diff --git a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java
index 5b4b6a35771b0..ce492dc70287f 100644
--- a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java
+++ b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java
@@ -62,13 +62,13 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AbstractRunnable;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexNotFoundException;
import org.opensearch.index.IndexService;
import org.opensearch.index.seqno.SequenceNumbers;
diff --git a/server/src/main/java/org/opensearch/action/support/replication/TransportWriteAction.java b/server/src/main/java/org/opensearch/action/support/replication/TransportWriteAction.java
index 26b15195cd8fc..1bcac6b7510d6 100644
--- a/server/src/main/java/org/opensearch/action/support/replication/TransportWriteAction.java
+++ b/server/src/main/java/org/opensearch/action/support/replication/TransportWriteAction.java
@@ -47,8 +47,8 @@
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.Nullable;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexingPressureService;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.mapper.MapperParsingException;
diff --git a/server/src/main/java/org/opensearch/client/Client.java b/server/src/main/java/org/opensearch/client/Client.java
index f20f0b4246cb6..3257c3efff131 100644
--- a/server/src/main/java/org/opensearch/client/Client.java
+++ b/server/src/main/java/org/opensearch/client/Client.java
@@ -84,10 +84,10 @@
import org.opensearch.action.update.UpdateRequestBuilder;
import org.opensearch.action.update.UpdateResponse;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import java.util.Map;
diff --git a/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java b/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java
index dd7363426af19..bb2d438b187aa 100644
--- a/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java
+++ b/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java
@@ -64,7 +64,6 @@
import org.opensearch.common.Strings;
import org.opensearch.common.component.AbstractLifecycleComponent;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
@@ -75,6 +74,7 @@
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.xcontent.json.JsonXContent;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.discovery.Discovery;
import org.opensearch.discovery.DiscoveryModule;
import org.opensearch.discovery.DiscoveryStats;
diff --git a/server/src/main/java/org/opensearch/cluster/coordination/ElectionSchedulerFactory.java b/server/src/main/java/org/opensearch/cluster/coordination/ElectionSchedulerFactory.java
index 828db5864d28b..ee53860837e7d 100644
--- a/server/src/main/java/org/opensearch/cluster/coordination/ElectionSchedulerFactory.java
+++ b/server/src/main/java/org/opensearch/cluster/coordination/ElectionSchedulerFactory.java
@@ -36,12 +36,12 @@
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.opensearch.common.SuppressForbidden;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AbstractRunnable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.threadpool.ThreadPool.Names;
diff --git a/server/src/main/java/org/opensearch/cluster/coordination/LeaderChecker.java b/server/src/main/java/org/opensearch/cluster/coordination/LeaderChecker.java
index 3d90c7366d2d6..a3a2760af8463 100644
--- a/server/src/main/java/org/opensearch/cluster/coordination/LeaderChecker.java
+++ b/server/src/main/java/org/opensearch/cluster/coordination/LeaderChecker.java
@@ -41,10 +41,10 @@
import org.opensearch.common.Nullable;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.monitor.NodeHealthService;
import org.opensearch.monitor.StatusInfo;
import org.opensearch.threadpool.ThreadPool.Names;
diff --git a/server/src/main/java/org/opensearch/cluster/coordination/PreVoteCollector.java b/server/src/main/java/org/opensearch/cluster/coordination/PreVoteCollector.java
index 2cf7ebcc850a5..3cc9cd119c1ab 100644
--- a/server/src/main/java/org/opensearch/cluster/coordination/PreVoteCollector.java
+++ b/server/src/main/java/org/opensearch/cluster/coordination/PreVoteCollector.java
@@ -41,7 +41,7 @@
import org.opensearch.common.Nullable;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.monitor.NodeHealthService;
import org.opensearch.monitor.StatusInfo;
import org.opensearch.threadpool.ThreadPool.Names;
diff --git a/server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java b/server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java
index a7d870513b107..3dd9c8c8b790d 100644
--- a/server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java
+++ b/server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java
@@ -51,12 +51,12 @@
import org.opensearch.common.Priority;
import org.opensearch.common.StopWatch;
import org.opensearch.common.component.AbstractLifecycleComponent;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor;
import org.opensearch.common.util.concurrent.ThreadContext;
diff --git a/server/src/main/java/org/opensearch/common/StopWatch.java b/server/src/main/java/org/opensearch/common/StopWatch.java
index 53b6da4a3bf02..5bdf083f0247b 100644
--- a/server/src/main/java/org/opensearch/common/StopWatch.java
+++ b/server/src/main/java/org/opensearch/common/StopWatch.java
@@ -32,8 +32,8 @@
package org.opensearch.common;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import java.text.NumberFormat;
import java.util.LinkedList;
diff --git a/server/src/main/java/org/opensearch/common/bytes/ReleasableBytesReference.java b/server/src/main/java/org/opensearch/common/bytes/ReleasableBytesReference.java
index 5345c46943518..7c5ef272d637f 100644
--- a/server/src/main/java/org/opensearch/common/bytes/ReleasableBytesReference.java
+++ b/server/src/main/java/org/opensearch/common/bytes/ReleasableBytesReference.java
@@ -36,7 +36,7 @@
import org.apache.lucene.util.BytesRefIterator;
import org.opensearch.common.concurrent.RefCountedReleasable;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/common/component/LifecycleComponent.java b/server/src/main/java/org/opensearch/common/component/LifecycleComponent.java
index 984d55df1bdfa..fc31e8ae3a35c 100644
--- a/server/src/main/java/org/opensearch/common/component/LifecycleComponent.java
+++ b/server/src/main/java/org/opensearch/common/component/LifecycleComponent.java
@@ -32,7 +32,7 @@
package org.opensearch.common.component;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
/**
* Base interface for a lifecycle component.
diff --git a/server/src/main/java/org/opensearch/common/compress/DeflateCompressor.java b/server/src/main/java/org/opensearch/common/compress/DeflateCompressor.java
index 1ab74b46a0c3d..07d34f07d4693 100644
--- a/server/src/main/java/org/opensearch/common/compress/DeflateCompressor.java
+++ b/server/src/main/java/org/opensearch/common/compress/DeflateCompressor.java
@@ -32,10 +32,10 @@
package org.opensearch.common.compress;
-import org.opensearch.core.Assertions;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.BytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.Assertions;
+import org.opensearch.core.common.lease.Releasable;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
diff --git a/server/src/main/java/org/opensearch/common/concurrent/RefCountedReleasable.java b/server/src/main/java/org/opensearch/common/concurrent/RefCountedReleasable.java
index 9ef73a672c1ad..b614c5e08ef22 100644
--- a/server/src/main/java/org/opensearch/common/concurrent/RefCountedReleasable.java
+++ b/server/src/main/java/org/opensearch/common/concurrent/RefCountedReleasable.java
@@ -13,8 +13,8 @@
package org.opensearch.common.concurrent;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AbstractRefCounted;
+import org.opensearch.core.common.lease.Releasable;
/**
* Decorator class that wraps an object reference as a {@link AbstractRefCounted} instance.
diff --git a/server/src/main/java/org/opensearch/common/io/stream/ReleasableBytesStreamOutput.java b/server/src/main/java/org/opensearch/common/io/stream/ReleasableBytesStreamOutput.java
index 0fd8640305326..d716e099cec5c 100644
--- a/server/src/main/java/org/opensearch/common/io/stream/ReleasableBytesStreamOutput.java
+++ b/server/src/main/java/org/opensearch/common/io/stream/ReleasableBytesStreamOutput.java
@@ -33,10 +33,10 @@
package org.opensearch.common.io.stream;
import org.opensearch.common.bytes.ReleasableBytesReference;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
/**
* An bytes stream output that allows providing a {@link BigArrays} instance
diff --git a/server/src/main/java/org/opensearch/common/io/stream/StreamInput.java b/server/src/main/java/org/opensearch/common/io/stream/StreamInput.java
index ad888fd592c72..7e0ef07c7e602 100644
--- a/server/src/main/java/org/opensearch/common/io/stream/StreamInput.java
+++ b/server/src/main/java/org/opensearch/common/io/stream/StreamInput.java
@@ -37,10 +37,8 @@
import org.apache.lucene.index.IndexFormatTooOldException;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.BitUtil;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.CharsRef;
import org.opensearch.Build;
import org.opensearch.OpenSearchException;
import org.opensearch.Version;
@@ -84,7 +82,6 @@
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -107,36 +104,6 @@
*/
public abstract class StreamInput extends BaseStreamInput {
- private Version version = Version.CURRENT;
-
- /**
- * The version of the node on the other side of this stream.
- */
- public Version getVersion() {
- return this.version;
- }
-
- /**
- * Set the version of the node on the other side of this stream.
- */
- public void setVersion(Version version) {
- this.version = version;
- }
-
- /**
- * Reads and returns a single byte.
- */
- public abstract byte readByte() throws IOException;
-
- /**
- * Reads a specified number of bytes into an array at the specified offset.
- *
- * @param b the array to read bytes into
- * @param offset the offset in the array to start storing bytes
- * @param len the number of bytes to read
- */
- public abstract void readBytes(byte[] b, int offset, int len) throws IOException;
-
/**
* Reads a bytes reference from this stream, might hold an actual reference to the underlying
* bytes of the stream.
@@ -187,21 +154,10 @@ public BytesRef readBytesRef(int length) throws IOException {
return new BytesRef(bytes, 0, length);
}
- public void readFully(byte[] b) throws IOException {
- readBytes(b, 0, b.length);
- }
-
public short readShort() throws IOException {
return (short) (((readByte() & 0xFF) << 8) | (readByte() & 0xFF));
}
- /**
- * Reads four bytes and returns an int.
- */
- public int readInt() throws IOException {
- return ((readByte() & 0xFF) << 24) | ((readByte() & 0xFF) << 16) | ((readByte() & 0xFF) << 8) | (readByte() & 0xFF);
- }
-
/**
* Reads an optional {@link Integer}.
*/
@@ -212,40 +168,6 @@ public Integer readOptionalInt() throws IOException {
return null;
}
- /**
- * Reads an int stored in variable-length format. Reads between one and
- * five bytes. Smaller values take fewer bytes. Negative numbers
- * will always use all 5 bytes and are therefore better serialized
- * using {@link #readInt}
- */
- public int readVInt() throws IOException {
- byte b = readByte();
- int i = b & 0x7F;
- if ((b & 0x80) == 0) {
- return i;
- }
- b = readByte();
- i |= (b & 0x7F) << 7;
- if ((b & 0x80) == 0) {
- return i;
- }
- b = readByte();
- i |= (b & 0x7F) << 14;
- if ((b & 0x80) == 0) {
- return i;
- }
- b = readByte();
- i |= (b & 0x7F) << 21;
- if ((b & 0x80) == 0) {
- return i;
- }
- b = readByte();
- if ((b & 0x80) != 0) {
- throw new IOException("Invalid vInt ((" + Integer.toHexString(b) + " & 0x7f) << 28) | " + Integer.toHexString(i));
- }
- return i | ((b & 0x7F) << 28);
- }
-
/**
* Reads eight bytes and returns a long.
*/
@@ -360,14 +282,6 @@ public Text readText() throws IOException {
return new Text(readBytesReference(length));
}
- @Nullable
- public String readOptionalString() throws IOException {
- if (readBoolean()) {
- return readString();
- }
- return null;
- }
-
@Nullable
public SecureString readOptionalSecureString() throws IOException {
SecureString value = null;
@@ -391,157 +305,6 @@ public Float readOptionalFloat() throws IOException {
return null;
}
- @Nullable
- public Integer readOptionalVInt() throws IOException {
- if (readBoolean()) {
- return readVInt();
- }
- return null;
- }
-
- // Maximum char-count to de-serialize via the thread-local CharsRef buffer
- private static final int SMALL_STRING_LIMIT = 1024;
-
- // Reusable bytes for deserializing strings
- private static final ThreadLocal stringReadBuffer = ThreadLocal.withInitial(() -> new byte[1024]);
-
- // Thread-local buffer for smaller strings
- private static final ThreadLocal smallSpare = ThreadLocal.withInitial(() -> new CharsRef(SMALL_STRING_LIMIT));
-
- // Larger buffer used for long strings that can't fit into the thread-local buffer
- // We don't use a CharsRefBuilder since we exactly know the size of the character array up front
- // this prevents calling grow for every character since we don't need this
- private CharsRef largeSpare;
-
- public String readString() throws IOException {
- final int charCount = readArraySize();
- final CharsRef charsRef;
- if (charCount > SMALL_STRING_LIMIT) {
- if (largeSpare == null) {
- largeSpare = new CharsRef(ArrayUtil.oversize(charCount, Character.BYTES));
- } else if (largeSpare.chars.length < charCount) {
- // we don't use ArrayUtils.grow since there is no need to copy the array
- largeSpare.chars = new char[ArrayUtil.oversize(charCount, Character.BYTES)];
- }
- charsRef = largeSpare;
- } else {
- charsRef = smallSpare.get();
- }
- charsRef.length = charCount;
- int charsOffset = 0;
- int offsetByteArray = 0;
- int sizeByteArray = 0;
- int missingFromPartial = 0;
- final byte[] byteBuffer = stringReadBuffer.get();
- final char[] charBuffer = charsRef.chars;
- for (; charsOffset < charCount;) {
- final int charsLeft = charCount - charsOffset;
- int bufferFree = byteBuffer.length - sizeByteArray;
- // Determine the minimum amount of bytes that are left in the string
- final int minRemainingBytes;
- if (missingFromPartial > 0) {
- // One byte for each remaining char except for the already partially read char
- minRemainingBytes = missingFromPartial + charsLeft - 1;
- missingFromPartial = 0;
- } else {
- // Each char has at least a single byte
- minRemainingBytes = charsLeft;
- }
- final int toRead;
- if (bufferFree < minRemainingBytes) {
- // We don't have enough space left in the byte array to read as much as we'd like to so we free up as many bytes in the
- // buffer by moving unused bytes that didn't make up a full char in the last iteration to the beginning of the buffer,
- // if there are any
- if (offsetByteArray > 0) {
- sizeByteArray = sizeByteArray - offsetByteArray;
- switch (sizeByteArray) { // We only have 0, 1 or 2 => no need to bother with a native call to System#arrayCopy
- case 1:
- byteBuffer[0] = byteBuffer[offsetByteArray];
- break;
- case 2:
- byteBuffer[0] = byteBuffer[offsetByteArray];
- byteBuffer[1] = byteBuffer[offsetByteArray + 1];
- break;
- }
- assert sizeByteArray <= 2 : "We never copy more than 2 bytes here since a char is 3 bytes max";
- toRead = Math.min(bufferFree + offsetByteArray, minRemainingBytes);
- offsetByteArray = 0;
- } else {
- toRead = bufferFree;
- }
- } else {
- toRead = minRemainingBytes;
- }
- readBytes(byteBuffer, sizeByteArray, toRead);
- sizeByteArray += toRead;
- // As long as we at least have three bytes buffered we don't need to do any bounds checking when getting the next char since we
- // read 3 bytes per char/iteration at most
- for (; offsetByteArray < sizeByteArray - 2; offsetByteArray++) {
- final int c = byteBuffer[offsetByteArray] & 0xff;
- switch (c >> 4) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- charBuffer[charsOffset++] = (char) c;
- break;
- case 12:
- case 13:
- charBuffer[charsOffset++] = (char) ((c & 0x1F) << 6 | byteBuffer[++offsetByteArray] & 0x3F);
- break;
- case 14:
- charBuffer[charsOffset++] = (char) ((c & 0x0F) << 12 | (byteBuffer[++offsetByteArray] & 0x3F) << 6
- | (byteBuffer[++offsetByteArray] & 0x3F));
- break;
- default:
- throwOnBrokenChar(c);
- }
- }
- // try to extract chars from remaining bytes with bounds checks for multi-byte chars
- final int bufferedBytesRemaining = sizeByteArray - offsetByteArray;
- for (int i = 0; i < bufferedBytesRemaining; i++) {
- final int c = byteBuffer[offsetByteArray] & 0xff;
- switch (c >> 4) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- charBuffer[charsOffset++] = (char) c;
- offsetByteArray++;
- break;
- case 12:
- case 13:
- missingFromPartial = 2 - (bufferedBytesRemaining - i);
- if (missingFromPartial == 0) {
- offsetByteArray++;
- charBuffer[charsOffset++] = (char) ((c & 0x1F) << 6 | byteBuffer[offsetByteArray++] & 0x3F);
- }
- ++i;
- break;
- case 14:
- missingFromPartial = 3 - (bufferedBytesRemaining - i);
- ++i;
- break;
- default:
- throwOnBrokenChar(c);
- }
- }
- }
- return charsRef.toString();
- }
-
- private static void throwOnBrokenChar(int c) throws IOException {
- throw new IOException("Invalid string; unexpected character: " + c + " hex: " + Integer.toHexString(c));
- }
-
public SecureString readSecureString() throws IOException {
BytesReference bytesRef = readBytesReference();
byte[] bytes = BytesReference.toBytes(bytesRef);
@@ -568,43 +331,6 @@ public final Double readOptionalDouble() throws IOException {
return null;
}
- /**
- * Reads a boolean.
- */
- public final boolean readBoolean() throws IOException {
- return readBoolean(readByte());
- }
-
- private boolean readBoolean(final byte value) {
- if (value == 0) {
- return false;
- } else if (value == 1) {
- return true;
- } else {
- final String message = String.format(Locale.ROOT, "unexpected byte [0x%02x]", value);
- throw new IllegalStateException(message);
- }
- }
-
- @Nullable
- public final Boolean readOptionalBoolean() throws IOException {
- final byte value = readByte();
- if (value == 2) {
- return null;
- } else {
- return readBoolean(value);
- }
- }
-
- /**
- * Closes the stream to further operations.
- */
- @Override
- public abstract void close() throws IOException;
-
- @Override
- public abstract int available() throws IOException;
-
public String[] readStringArray() throws IOException {
int size = readArraySize();
if (size == 0) {
@@ -1186,25 +912,6 @@ public Set readSet(Writeable.Reader reader) throws IOException {
return readCollection(reader, HashSet::new, Collections.emptySet());
}
- /**
- * Reads a collection of objects
- */
- private > C readCollection(
- BaseWriteable.Reader reader,
- IntFunction constructor,
- C empty
- ) throws IOException {
- int count = readArraySize();
- if (count == 0) {
- return empty;
- }
- C builder = constructor.apply(count);
- for (int i = 0; i < count; i++) {
- builder.add(reader.read(this));
- }
- return builder;
- }
-
/**
* Reads a list of {@link NamedWriteable}s. If the returned list contains any entries it will be mutable.
* If it is empty it might be immutable.
@@ -1260,29 +967,11 @@ public static StreamInput wrap(byte[] bytes, int offset, int length) {
return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length), length);
}
- /**
- * Reads a vint via {@link #readVInt()} and applies basic checks to ensure the read array size is sane.
- * This method uses {@link #ensureCanReadBytes(int)} to ensure this stream has enough bytes to read for the read array size.
- */
- private int readArraySize() throws IOException {
- final int arraySize = readVInt();
- if (arraySize > ArrayUtil.MAX_ARRAY_LENGTH) {
- throw new IllegalStateException("array length must be <= to " + ArrayUtil.MAX_ARRAY_LENGTH + " but was: " + arraySize);
- }
- if (arraySize < 0) {
- throw new NegativeArraySizeException("array size must be positive but was: " + arraySize);
- }
- // lets do a sanity check that if we are reading an array size that is bigger that the remaining bytes we can safely
- // throw an exception instead of allocating the array based on the size. A simple corrutpted byte can make a node go OOM
- // if the size is large and for perf reasons we allocate arrays ahead of time
- ensureCanReadBytes(arraySize);
- return arraySize;
- }
-
/**
* This method throws an {@link EOFException} if the given number of bytes can not be read from the this stream. This method might
* be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.
*/
+ @Override
protected abstract void ensureCanReadBytes(int length) throws EOFException;
private static final TimeUnit[] TIME_UNITS = TimeUnit.values();
diff --git a/server/src/main/java/org/opensearch/common/io/stream/StreamOutput.java b/server/src/main/java/org/opensearch/common/io/stream/StreamOutput.java
index 8f70b1dff55e6..8911e90aa7511 100644
--- a/server/src/main/java/org/opensearch/common/io/stream/StreamOutput.java
+++ b/server/src/main/java/org/opensearch/common/io/stream/StreamOutput.java
@@ -104,23 +104,8 @@ public abstract class StreamOutput extends BaseStreamOutput {
private static final int MAX_NESTED_EXCEPTION_LEVEL = 100;
- private Version version = Version.CURRENT;
private Set features = Collections.emptySet();
- /**
- * The version of the node on the other side of this stream.
- */
- public Version getVersion() {
- return this.version;
- }
-
- /**
- * Set the version of the node on the other side of this stream.
- */
- public void setVersion(Version version) {
- this.version = version;
- }
-
/**
* Test if the stream has the specified feature. Features are used when serializing {@link ClusterState.Custom} or
* {@link Metadata.Custom}; see also {@link ClusterState.FeatureAware}.
@@ -154,11 +139,6 @@ public void seek(long position) throws IOException {
throw new UnsupportedOperationException();
}
- /**
- * Writes a single byte.
- */
- public abstract void writeByte(byte b) throws IOException;
-
/**
* Writes an array of bytes.
*
@@ -178,15 +158,6 @@ public void writeBytes(byte[] b, int length) throws IOException {
writeBytes(b, 0, length);
}
- /**
- * Writes an array of bytes.
- *
- * @param b the bytes to write
- * @param offset the offset in the byte array
- * @param length the number of bytes to write
- */
- public abstract void writeBytes(byte[] b, int offset, int length) throws IOException;
-
/**
* Writes an array of bytes.
*
@@ -231,8 +202,6 @@ public void writeBytesRef(BytesRef bytes) throws IOException {
write(bytes.bytes, bytes.offset, bytes.length);
}
- private static final ThreadLocal scratch = ThreadLocal.withInitial(() -> new byte[1024]);
-
public final void writeShort(short v) throws IOException {
final byte[] buffer = scratch.get();
buffer[0] = (byte) (v >> 8);
@@ -240,49 +209,6 @@ public final void writeShort(short v) throws IOException {
writeBytes(buffer, 0, 2);
}
- /**
- * Writes an int as four bytes.
- */
- public void writeInt(int i) throws IOException {
- final byte[] buffer = scratch.get();
- buffer[0] = (byte) (i >> 24);
- buffer[1] = (byte) (i >> 16);
- buffer[2] = (byte) (i >> 8);
- buffer[3] = (byte) i;
- writeBytes(buffer, 0, 4);
- }
-
- /**
- * Writes an int in a variable-length format. Writes between one and
- * five bytes. Smaller values take fewer bytes. Negative numbers
- * will always use all 5 bytes and are therefore better serialized
- * using {@link #writeInt}
- */
- public void writeVInt(int i) throws IOException {
- /*
- * Shortcut writing single byte because it is very, very common and
- * can skip grabbing the scratch buffer. This is marginally slower
- * than hand unrolling the entire encoding loop but hand unrolling
- * the encoding loop blows out the method size so it can't be inlined.
- * In that case benchmarks of the method itself are faster but
- * benchmarks of methods that use this method are slower.
- * This is philosophically in line with vint in general - it biases
- * twoards being simple and fast for smaller numbers.
- */
- if (Integer.numberOfLeadingZeros(i) >= 25) {
- writeByte((byte) i);
- return;
- }
- byte[] buffer = scratch.get();
- int index = 0;
- do {
- buffer[index++] = ((byte) ((i & 0x7f) | 0x80));
- i >>>= 7;
- } while ((i & ~0x7F) != 0);
- buffer[index++] = ((byte) i);
- writeBytes(buffer, 0, index);
- }
-
/**
* Writes a long as eight bytes.
*/
@@ -386,27 +312,6 @@ public void writeOptionalSecureString(@Nullable SecureString secureStr) throws I
}
}
- /**
- * Writes an optional {@link Integer}.
- */
- public void writeOptionalInt(@Nullable Integer integer) throws IOException {
- if (integer == null) {
- writeBoolean(false);
- } else {
- writeBoolean(true);
- writeInt(integer);
- }
- }
-
- public void writeOptionalVInt(@Nullable Integer integer) throws IOException {
- if (integer == null) {
- writeBoolean(false);
- } else {
- writeBoolean(true);
- writeVInt(integer);
- }
- }
-
public void writeOptionalFloat(@Nullable Float floatValue) throws IOException {
if (floatValue == null) {
writeBoolean(false);
@@ -497,39 +402,6 @@ public final void writeBigInteger(BigInteger v) throws IOException {
writeString(v.toString());
}
- private static byte ZERO = 0;
- private static byte ONE = 1;
- private static byte TWO = 2;
-
- /**
- * Writes a boolean.
- */
- public void writeBoolean(boolean b) throws IOException {
- writeByte(b ? ONE : ZERO);
- }
-
- public void writeOptionalBoolean(@Nullable Boolean b) throws IOException {
- if (b == null) {
- writeByte(TWO);
- } else {
- writeBoolean(b);
- }
- }
-
- /**
- * Forces any buffered output to be written.
- */
- @Override
- public abstract void flush() throws IOException;
-
- /**
- * Closes this stream to further operations.
- */
- @Override
- public abstract void close() throws IOException;
-
- public abstract void reset() throws IOException;
-
@Override
public void write(int b) throws IOException {
writeByte((byte) b);
diff --git a/server/src/main/java/org/opensearch/common/lucene/index/FreqTermsEnum.java b/server/src/main/java/org/opensearch/common/lucene/index/FreqTermsEnum.java
index eabdc25f1125a..2ebbf8c69ad5a 100644
--- a/server/src/main/java/org/opensearch/common/lucene/index/FreqTermsEnum.java
+++ b/server/src/main/java/org/opensearch/common/lucene/index/FreqTermsEnum.java
@@ -37,12 +37,12 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BytesRefHash;
import org.opensearch.common.util.IntArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/common/recycler/Recycler.java b/server/src/main/java/org/opensearch/common/recycler/Recycler.java
index 0b0c98772a77c..af09c0f0e2eab 100644
--- a/server/src/main/java/org/opensearch/common/recycler/Recycler.java
+++ b/server/src/main/java/org/opensearch/common/recycler/Recycler.java
@@ -32,7 +32,7 @@
package org.opensearch.common.recycler;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
/**
* A recycled object, note, implementations should support calling obtain and then recycle
diff --git a/server/src/main/java/org/opensearch/common/util/AbstractBigArray.java b/server/src/main/java/org/opensearch/common/util/AbstractBigArray.java
index e8fd3990befa8..0ee1f4b48b37e 100644
--- a/server/src/main/java/org/opensearch/common/util/AbstractBigArray.java
+++ b/server/src/main/java/org/opensearch/common/util/AbstractBigArray.java
@@ -34,7 +34,7 @@
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.RamUsageEstimator;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.common.recycler.Recycler;
import java.lang.reflect.Array;
diff --git a/server/src/main/java/org/opensearch/common/util/AbstractHash.java b/server/src/main/java/org/opensearch/common/util/AbstractHash.java
index ce12a4f5d1bf2..d77e63d1a659c 100644
--- a/server/src/main/java/org/opensearch/common/util/AbstractHash.java
+++ b/server/src/main/java/org/opensearch/common/util/AbstractHash.java
@@ -32,7 +32,7 @@
package org.opensearch.common.util;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
/**
* Base implementation for {@link BytesRefHash} and {@link LongHash}, or any class that
diff --git a/server/src/main/java/org/opensearch/common/util/AbstractPagedHashMap.java b/server/src/main/java/org/opensearch/common/util/AbstractPagedHashMap.java
index 1ff3038297008..e61bb8b45e711 100644
--- a/server/src/main/java/org/opensearch/common/util/AbstractPagedHashMap.java
+++ b/server/src/main/java/org/opensearch/common/util/AbstractPagedHashMap.java
@@ -33,7 +33,7 @@
package org.opensearch.common.util;
import com.carrotsearch.hppc.BitMixer;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
/**
* Base implementation for a hash table that is paged, recycles arrays and grows in-place.
diff --git a/server/src/main/java/org/opensearch/common/util/BigArray.java b/server/src/main/java/org/opensearch/common/util/BigArray.java
index f6cac6374bbeb..35467c6fa1ad3 100644
--- a/server/src/main/java/org/opensearch/common/util/BigArray.java
+++ b/server/src/main/java/org/opensearch/common/util/BigArray.java
@@ -33,7 +33,7 @@
package org.opensearch.common.util;
import org.apache.lucene.util.Accountable;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
/**
* Base abstraction of an array.
diff --git a/server/src/main/java/org/opensearch/common/util/BigArrays.java b/server/src/main/java/org/opensearch/common/util/BigArrays.java
index b3a4a7d25d3f5..5351494d0abc9 100644
--- a/server/src/main/java/org/opensearch/common/util/BigArrays.java
+++ b/server/src/main/java/org/opensearch/common/util/BigArrays.java
@@ -38,9 +38,9 @@
import org.opensearch.common.Nullable;
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.breaker.CircuitBreakingException;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.recycler.Recycler;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.indices.breaker.CircuitBreakerService;
import java.util.Arrays;
diff --git a/server/src/main/java/org/opensearch/common/util/BitArray.java b/server/src/main/java/org/opensearch/common/util/BitArray.java
index b75a5d07e70d7..4d701a9cbe2c8 100644
--- a/server/src/main/java/org/opensearch/common/util/BitArray.java
+++ b/server/src/main/java/org/opensearch/common/util/BitArray.java
@@ -32,8 +32,8 @@
package org.opensearch.common.util;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
/**
* A bit array that is implemented using a growing {@link LongArray}
diff --git a/server/src/main/java/org/opensearch/common/util/BytesRefHash.java b/server/src/main/java/org/opensearch/common/util/BytesRefHash.java
index eb44b30a7e36c..03275adb278ad 100644
--- a/server/src/main/java/org/opensearch/common/util/BytesRefHash.java
+++ b/server/src/main/java/org/opensearch/common/util/BytesRefHash.java
@@ -34,8 +34,8 @@
import com.carrotsearch.hppc.BitMixer;
import org.apache.lucene.util.BytesRef;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
/**
* Specialized hash table implementation similar to Lucene's BytesRefHash that maps
diff --git a/server/src/main/java/org/opensearch/common/util/LongHash.java b/server/src/main/java/org/opensearch/common/util/LongHash.java
index 71272e79c65b3..8ec0f1565c4d5 100644
--- a/server/src/main/java/org/opensearch/common/util/LongHash.java
+++ b/server/src/main/java/org/opensearch/common/util/LongHash.java
@@ -32,7 +32,7 @@
package org.opensearch.common.util;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
/**
* Specialized hash table implementation similar to BytesRefHash that maps
diff --git a/server/src/main/java/org/opensearch/common/util/LongLongHash.java b/server/src/main/java/org/opensearch/common/util/LongLongHash.java
index 1a720eae82a1d..0dd13b4208c7a 100644
--- a/server/src/main/java/org/opensearch/common/util/LongLongHash.java
+++ b/server/src/main/java/org/opensearch/common/util/LongLongHash.java
@@ -34,7 +34,7 @@
import com.carrotsearch.hppc.BitMixer;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
/**
* Specialized hash table implementation similar to BytesRefHash that maps
diff --git a/server/src/main/java/org/opensearch/common/util/LongObjectPagedHashMap.java b/server/src/main/java/org/opensearch/common/util/LongObjectPagedHashMap.java
index 9d654e96779bf..116b74baa24d1 100644
--- a/server/src/main/java/org/opensearch/common/util/LongObjectPagedHashMap.java
+++ b/server/src/main/java/org/opensearch/common/util/LongObjectPagedHashMap.java
@@ -32,7 +32,7 @@
package org.opensearch.common.util;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import java.util.Iterator;
import java.util.NoSuchElementException;
diff --git a/server/src/main/java/org/opensearch/common/util/concurrent/KeyedLock.java b/server/src/main/java/org/opensearch/common/util/concurrent/KeyedLock.java
index 9d4235f8d8a1a..bb863654469ee 100644
--- a/server/src/main/java/org/opensearch/common/util/concurrent/KeyedLock.java
+++ b/server/src/main/java/org/opensearch/common/util/concurrent/KeyedLock.java
@@ -32,7 +32,7 @@
package org.opensearch.common.util.concurrent;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/server/src/main/java/org/opensearch/common/util/concurrent/ReleasableLock.java b/server/src/main/java/org/opensearch/common/util/concurrent/ReleasableLock.java
index 883239cea9d99..8e3c4cbc64da6 100644
--- a/server/src/main/java/org/opensearch/common/util/concurrent/ReleasableLock.java
+++ b/server/src/main/java/org/opensearch/common/util/concurrent/ReleasableLock.java
@@ -32,9 +32,9 @@
package org.opensearch.common.util.concurrent;
-import org.opensearch.core.Assertions;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.Assertions;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.engine.EngineException;
import java.util.concurrent.locks.Lock;
diff --git a/server/src/main/java/org/opensearch/env/NodeEnvironment.java b/server/src/main/java/org/opensearch/env/NodeEnvironment.java
index c6435488743f3..32d81e8e1e482 100644
--- a/server/src/main/java/org/opensearch/env/NodeEnvironment.java
+++ b/server/src/main/java/org/opensearch/env/NodeEnvironment.java
@@ -54,15 +54,15 @@
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.UUIDs;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.core.util.FileSystemUtils;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.unit.TimeValue;
-import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.util.FileSystemUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.gateway.MetadataStateFormat;
import org.opensearch.gateway.PersistedClusterStateService;
import org.opensearch.index.Index;
diff --git a/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java b/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java
index 35272d9f54dc6..0b8756e499fd0 100644
--- a/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java
+++ b/server/src/main/java/org/opensearch/gateway/AsyncShardFetch.java
@@ -43,7 +43,7 @@
import org.opensearch.cluster.node.DiscoveryNodes;
import org.opensearch.cluster.routing.allocation.RoutingAllocation;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.ShardId;
import org.opensearch.transport.ReceiveTimeoutTransportException;
diff --git a/server/src/main/java/org/opensearch/gateway/GatewayAllocator.java b/server/src/main/java/org/opensearch/gateway/GatewayAllocator.java
index 0fbb48b6ca73f..fe8504158abc2 100644
--- a/server/src/main/java/org/opensearch/gateway/GatewayAllocator.java
+++ b/server/src/main/java/org/opensearch/gateway/GatewayAllocator.java
@@ -49,9 +49,9 @@
import org.opensearch.cluster.routing.allocation.RoutingAllocation;
import org.opensearch.common.Priority;
import org.opensearch.common.inject.Inject;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.util.set.Sets;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.store.TransportNodesListShardStoreMetadata;
diff --git a/server/src/main/java/org/opensearch/gateway/PersistedClusterStateService.java b/server/src/main/java/org/opensearch/gateway/PersistedClusterStateService.java
index 54c5d88918e45..217bac3b4b99d 100644
--- a/server/src/main/java/org/opensearch/gateway/PersistedClusterStateService.java
+++ b/server/src/main/java/org/opensearch/gateway/PersistedClusterStateService.java
@@ -69,8 +69,6 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.bytes.RecyclingBytesStreamOutput;
import org.opensearch.common.io.Streams;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.logging.Loggers;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.settings.ClusterSettings;
@@ -80,12 +78,14 @@
import org.opensearch.common.util.ByteArray;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
-import org.opensearch.core.xcontent.NamedXContentRegistry;
-import org.opensearch.core.xcontent.ToXContent;
-import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
+import org.opensearch.core.xcontent.NamedXContentRegistry;
+import org.opensearch.core.xcontent.ToXContent;
+import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.env.NodeMetadata;
import org.opensearch.index.Index;
diff --git a/server/src/main/java/org/opensearch/http/DefaultRestChannel.java b/server/src/main/java/org/opensearch/http/DefaultRestChannel.java
index 9df59cbb6f377..8f94bf4c7717d 100644
--- a/server/src/main/java/org/opensearch/http/DefaultRestChannel.java
+++ b/server/src/main/java/org/opensearch/http/DefaultRestChannel.java
@@ -38,11 +38,11 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.ReleasableBytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.network.CloseableChannel;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.rest.AbstractRestChannel;
import org.opensearch.rest.RestChannel;
import org.opensearch.rest.RestRequest;
diff --git a/server/src/main/java/org/opensearch/index/IndexingPressure.java b/server/src/main/java/org/opensearch/index/IndexingPressure.java
index 6285a06286e29..4dfea7f50fde8 100644
--- a/server/src/main/java/org/opensearch/index/IndexingPressure.java
+++ b/server/src/main/java/org/opensearch/index/IndexingPressure.java
@@ -35,10 +35,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.common.inject.Inject;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.ByteSizeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.stats.IndexingPressureStats;
diff --git a/server/src/main/java/org/opensearch/index/IndexingPressureService.java b/server/src/main/java/org/opensearch/index/IndexingPressureService.java
index 8abc0172d7c6f..1c683189cd34e 100644
--- a/server/src/main/java/org/opensearch/index/IndexingPressureService.java
+++ b/server/src/main/java/org/opensearch/index/IndexingPressureService.java
@@ -7,8 +7,8 @@
import org.opensearch.action.admin.indices.stats.CommonStatsFlags;
import org.opensearch.cluster.service.ClusterService;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.ShardId;
import org.opensearch.index.stats.IndexingPressureStats;
import org.opensearch.index.stats.ShardIndexingPressureStats;
diff --git a/server/src/main/java/org/opensearch/index/ShardIndexingPressure.java b/server/src/main/java/org/opensearch/index/ShardIndexingPressure.java
index 09e809c902ec6..d14910e14eafb 100644
--- a/server/src/main/java/org/opensearch/index/ShardIndexingPressure.java
+++ b/server/src/main/java/org/opensearch/index/ShardIndexingPressure.java
@@ -9,9 +9,9 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.admin.indices.stats.CommonStatsFlags;
import org.opensearch.cluster.service.ClusterService;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.ShardIndexingPressureTracker.CommonOperationTracker;
import org.opensearch.index.ShardIndexingPressureTracker.OperationTracker;
diff --git a/server/src/main/java/org/opensearch/index/engine/Engine.java b/server/src/main/java/org/opensearch/index/engine/Engine.java
index 80f7c353d4a60..51cdef861f445 100644
--- a/server/src/main/java/org/opensearch/index/engine/Engine.java
+++ b/server/src/main/java/org/opensearch/index/engine/Engine.java
@@ -61,8 +61,6 @@
import org.opensearch.common.SetOnce;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.logging.Loggers;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
@@ -74,6 +72,8 @@
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.ReleasableLock;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.VersionType;
import org.opensearch.index.mapper.IdFieldMapper;
import org.opensearch.index.mapper.Mapping;
diff --git a/server/src/main/java/org/opensearch/index/engine/InternalEngine.java b/server/src/main/java/org/opensearch/index/engine/InternalEngine.java
index 74ad2e31f8eae..e777a9ef724a9 100644
--- a/server/src/main/java/org/opensearch/index/engine/InternalEngine.java
+++ b/server/src/main/java/org/opensearch/index/engine/InternalEngine.java
@@ -72,7 +72,6 @@
import org.opensearch.common.Nullable;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.LoggerInfoStream;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
@@ -87,6 +86,7 @@
import org.opensearch.common.util.concurrent.KeyedLock;
import org.opensearch.common.util.concurrent.ReleasableLock;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.VersionType;
import org.opensearch.index.fieldvisitor.IdOnlyFieldVisitor;
diff --git a/server/src/main/java/org/opensearch/index/engine/LiveVersionMap.java b/server/src/main/java/org/opensearch/index/engine/LiveVersionMap.java
index 87ff449ee74e0..1ea4d7143b284 100644
--- a/server/src/main/java/org/opensearch/index/engine/LiveVersionMap.java
+++ b/server/src/main/java/org/opensearch/index/engine/LiveVersionMap.java
@@ -36,9 +36,9 @@
import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.RamUsageEstimator;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.util.concurrent.KeyedLock;
+import org.opensearch.core.common.lease.Releasable;
import java.io.IOException;
import java.util.Collection;
diff --git a/server/src/main/java/org/opensearch/index/engine/SoftDeletesPolicy.java b/server/src/main/java/org/opensearch/index/engine/SoftDeletesPolicy.java
index eef73f1d49a8e..81da845a04230 100644
--- a/server/src/main/java/org/opensearch/index/engine/SoftDeletesPolicy.java
+++ b/server/src/main/java/org/opensearch/index/engine/SoftDeletesPolicy.java
@@ -34,7 +34,7 @@
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.search.Query;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.mapper.SeqNoFieldMapper;
import org.opensearch.index.seqno.RetentionLease;
import org.opensearch.index.seqno.RetentionLeases;
diff --git a/server/src/main/java/org/opensearch/index/fielddata/LeafFieldData.java b/server/src/main/java/org/opensearch/index/fielddata/LeafFieldData.java
index 2982363937710..88aa44fe02ed3 100644
--- a/server/src/main/java/org/opensearch/index/fielddata/LeafFieldData.java
+++ b/server/src/main/java/org/opensearch/index/fielddata/LeafFieldData.java
@@ -33,7 +33,7 @@
package org.opensearch.index.fielddata;
import org.apache.lucene.util.Accountable;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.mapper.DocValueFetcher;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/index/seqno/RetentionLeaseActions.java b/server/src/main/java/org/opensearch/index/seqno/RetentionLeaseActions.java
index 2ce0f1f524a43..6476b1f0dc1c4 100644
--- a/server/src/main/java/org/opensearch/index/seqno/RetentionLeaseActions.java
+++ b/server/src/main/java/org/opensearch/index/seqno/RetentionLeaseActions.java
@@ -47,7 +47,7 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexService;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.shard.ShardId;
diff --git a/server/src/main/java/org/opensearch/index/shard/IndexShard.java b/server/src/main/java/org/opensearch/index/shard/IndexShard.java
index 2ec0d186bf056..a3ef1460bfd43 100644
--- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java
+++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java
@@ -82,8 +82,6 @@
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.concurrent.GatedCloseable;
import org.opensearch.common.io.stream.BytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
import org.opensearch.common.metrics.CounterMetric;
@@ -100,6 +98,8 @@
import org.opensearch.common.util.set.Sets;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.gateway.WriteStateException;
import org.opensearch.index.Index;
import org.opensearch.index.IndexModule;
diff --git a/server/src/main/java/org/opensearch/index/shard/IndexShardOperationPermits.java b/server/src/main/java/org/opensearch/index/shard/IndexShardOperationPermits.java
index b6af2030d7fb6..8279a2f6399c5 100644
--- a/server/src/main/java/org/opensearch/index/shard/IndexShardOperationPermits.java
+++ b/server/src/main/java/org/opensearch/index/shard/IndexShardOperationPermits.java
@@ -39,11 +39,11 @@
import org.opensearch.action.support.ContextPreservingActionListener;
import org.opensearch.common.CheckedRunnable;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.RunOnce;
import org.opensearch.common.util.concurrent.ThreadContext.StoredContext;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.threadpool.ThreadPool;
import java.io.Closeable;
diff --git a/server/src/main/java/org/opensearch/index/shard/RefreshListeners.java b/server/src/main/java/org/opensearch/index/shard/RefreshListeners.java
index 7dbbcbb2d7d20..c1934596cd5c0 100644
--- a/server/src/main/java/org/opensearch/index/shard/RefreshListeners.java
+++ b/server/src/main/java/org/opensearch/index/shard/RefreshListeners.java
@@ -35,10 +35,10 @@
import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.ReferenceManager;
import org.opensearch.common.collect.Tuple;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.metrics.MeanMetric;
import org.opensearch.common.util.concurrent.RunOnce;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.translog.Translog;
import java.io.Closeable;
diff --git a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java
index e2a770fd8322e..02d91974b652a 100644
--- a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java
+++ b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java
@@ -11,11 +11,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.common.SetOnce;
-import org.opensearch.core.util.FileSystemUtils;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.concurrent.ReleasableLock;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.util.FileSystemUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.shard.ShardId;
import org.opensearch.index.translog.transfer.BlobStoreTransferService;
import org.opensearch.index.translog.transfer.FileTransferTracker;
diff --git a/server/src/main/java/org/opensearch/index/translog/Translog.java b/server/src/main/java/org/opensearch/index/translog/Translog.java
index 0082d3f10c9da..422864219745b 100644
--- a/server/src/main/java/org/opensearch/index/translog/Translog.java
+++ b/server/src/main/java/org/opensearch/index/translog/Translog.java
@@ -42,12 +42,12 @@
import org.opensearch.common.io.stream.ReleasableBytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.concurrent.ReleasableLock;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.common.Strings;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.VersionType;
diff --git a/server/src/main/java/org/opensearch/index/translog/TranslogDeletionPolicy.java b/server/src/main/java/org/opensearch/index/translog/TranslogDeletionPolicy.java
index fde6d6bbc0632..608b860580f79 100644
--- a/server/src/main/java/org/opensearch/index/translog/TranslogDeletionPolicy.java
+++ b/server/src/main/java/org/opensearch/index/translog/TranslogDeletionPolicy.java
@@ -34,7 +34,7 @@
import org.apache.lucene.util.Counter;
import org.opensearch.core.Assertions;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.seqno.SequenceNumbers;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/index/translog/TranslogWriter.java b/server/src/main/java/org/opensearch/index/translog/TranslogWriter.java
index 26d6d9ff8488c..5584c08410a91 100644
--- a/server/src/main/java/org/opensearch/index/translog/TranslogWriter.java
+++ b/server/src/main/java/org/opensearch/index/translog/TranslogWriter.java
@@ -45,11 +45,11 @@
import org.opensearch.common.io.Channels;
import org.opensearch.common.io.DiskIoBufferPool;
import org.opensearch.common.io.stream.ReleasableBytesStreamOutput;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.concurrent.ReleasableLock;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.Assertions;
import org.opensearch.index.seqno.SequenceNumbers;
import org.opensearch.index.shard.ShardId;
diff --git a/server/src/main/java/org/opensearch/indices/IndicesService.java b/server/src/main/java/org/opensearch/indices/IndicesService.java
index 58a26f813d88d..f7c351026e644 100644
--- a/server/src/main/java/org/opensearch/indices/IndicesService.java
+++ b/server/src/main/java/org/opensearch/indices/IndicesService.java
@@ -63,13 +63,11 @@
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.component.AbstractLifecycleComponent;
-import org.opensearch.core.util.FileSystemUtils;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.IndexScopedSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
@@ -80,16 +78,18 @@
import org.opensearch.common.util.concurrent.AbstractRefCounted;
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
-import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.common.util.concurrent.OpenSearchThreadPoolExecutor;
import org.opensearch.common.util.iterable.Iterables;
import org.opensearch.common.util.set.Sets;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
-import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.XContentFactory;
-import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
+import org.opensearch.core.util.FileSystemUtils;
+import org.opensearch.core.xcontent.NamedXContentRegistry;
+import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.env.ShardLock;
import org.opensearch.env.ShardLockObtainFailedException;
diff --git a/server/src/main/java/org/opensearch/indices/RunUnderPrimaryPermit.java b/server/src/main/java/org/opensearch/indices/RunUnderPrimaryPermit.java
index 29cac1601dc67..da410f6f629cc 100644
--- a/server/src/main/java/org/opensearch/indices/RunUnderPrimaryPermit.java
+++ b/server/src/main/java/org/opensearch/indices/RunUnderPrimaryPermit.java
@@ -10,9 +10,9 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionListener;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.CancellableThreads;
import org.opensearch.common.util.concurrent.FutureUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.shard.IndexShardRelocatedException;
import org.opensearch.threadpool.ThreadPool;
diff --git a/server/src/main/java/org/opensearch/indices/fielddata/cache/IndicesFieldDataCache.java b/server/src/main/java/org/opensearch/indices/fielddata/cache/IndicesFieldDataCache.java
index 8d75cb33ba991..f37e1b3351c06 100644
--- a/server/src/main/java/org/opensearch/indices/fielddata/cache/IndicesFieldDataCache.java
+++ b/server/src/main/java/org/opensearch/indices/fielddata/cache/IndicesFieldDataCache.java
@@ -47,12 +47,12 @@
import org.opensearch.common.cache.RemovalListener;
import org.opensearch.common.cache.RemovalNotification;
import org.opensearch.common.cache.RemovalReason;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.ByteSizeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.fielddata.LeafFieldData;
import org.opensearch.index.fielddata.IndexFieldData;
diff --git a/server/src/main/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandler.java b/server/src/main/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandler.java
index c8d3b2d09ad28..7c8e1c743426c 100644
--- a/server/src/main/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandler.java
+++ b/server/src/main/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandler.java
@@ -17,8 +17,8 @@
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.SetOnce;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.engine.RecoveryEngineException;
import org.opensearch.index.seqno.ReplicationTracker;
import org.opensearch.index.seqno.RetentionLease;
diff --git a/server/src/main/java/org/opensearch/indices/recovery/MultiFileWriter.java b/server/src/main/java/org/opensearch/indices/recovery/MultiFileWriter.java
index 5364bbbdc51c1..e7c374f431242 100644
--- a/server/src/main/java/org/opensearch/indices/recovery/MultiFileWriter.java
+++ b/server/src/main/java/org/opensearch/indices/recovery/MultiFileWriter.java
@@ -38,9 +38,9 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefIterator;
import org.opensearch.common.bytes.BytesReference;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AbstractRefCounted;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.common.Strings;
import org.opensearch.index.store.Store;
import org.opensearch.index.store.StoreFileMetadata;
diff --git a/server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandler.java b/server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandler.java
index 052b86c901093..797a5b11cefe6 100644
--- a/server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandler.java
+++ b/server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandler.java
@@ -48,8 +48,6 @@
import org.opensearch.common.CheckedRunnable;
import org.opensearch.common.StopWatch;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.logging.Loggers;
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.unit.TimeValue;
@@ -58,6 +56,8 @@
import org.opensearch.common.util.concurrent.ListenableFuture;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.engine.RecoveryEngineException;
import org.opensearch.index.seqno.RetentionLease;
import org.opensearch.index.seqno.RetentionLeaseNotFoundException;
diff --git a/server/src/main/java/org/opensearch/indices/recovery/RemoteStorePeerRecoverySourceHandler.java b/server/src/main/java/org/opensearch/indices/recovery/RemoteStorePeerRecoverySourceHandler.java
index ff218ef71e397..7c51812ec94a2 100644
--- a/server/src/main/java/org/opensearch/indices/recovery/RemoteStorePeerRecoverySourceHandler.java
+++ b/server/src/main/java/org/opensearch/indices/recovery/RemoteStorePeerRecoverySourceHandler.java
@@ -12,8 +12,8 @@
import org.opensearch.action.ActionListener;
import org.opensearch.action.StepListener;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.engine.RecoveryEngineException;
import org.opensearch.index.seqno.SequenceNumbers;
import org.opensearch.index.shard.IndexShard;
diff --git a/server/src/main/java/org/opensearch/indices/replication/SegmentFileTransferHandler.java b/server/src/main/java/org/opensearch/indices/replication/SegmentFileTransferHandler.java
index 5411b6b2c9068..c303a53c827f8 100644
--- a/server/src/main/java/org/opensearch/indices/replication/SegmentFileTransferHandler.java
+++ b/server/src/main/java/org/opensearch/indices/replication/SegmentFileTransferHandler.java
@@ -19,10 +19,10 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.bytes.BytesReference;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.store.InputStreamIndexInput;
import org.opensearch.common.util.CancellableThreads;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.store.Store;
import org.opensearch.index.store.StoreFileMetadata;
diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java
index a25bac60f49b6..dd205ad87812b 100644
--- a/server/src/main/java/org/opensearch/node/Node.java
+++ b/server/src/main/java/org/opensearch/node/Node.java
@@ -113,7 +113,6 @@
import org.opensearch.common.inject.Module;
import org.opensearch.common.inject.ModulesBuilder;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.logging.HeaderWarning;
import org.opensearch.common.logging.NodeAndClusterIdStateListener;
@@ -132,8 +131,9 @@
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.PageCacheRecycler;
-import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasables;
+import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.discovery.Discovery;
import org.opensearch.discovery.DiscoveryModule;
import org.opensearch.env.Environment;
diff --git a/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java
index 59694bb5b478f..ab6797b745044 100644
--- a/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java
+++ b/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java
@@ -84,7 +84,6 @@
import org.opensearch.common.compress.CompressorType;
import org.opensearch.common.compress.NotXContentException;
import org.opensearch.common.io.Streams;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.store.InputStreamIndexInput;
import org.opensearch.common.metrics.CounterMetric;
@@ -96,11 +95,12 @@
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
+import org.opensearch.common.xcontent.XContentFactory;
+import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.util.BytesRefUtils;
import org.opensearch.core.xcontent.NamedXContentRegistry;
-import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.core.xcontent.XContentParser;
-import org.opensearch.common.xcontent.XContentType;
import org.opensearch.index.mapper.MapperService;
import org.opensearch.index.shard.ShardId;
import org.opensearch.index.snapshots.IndexShardRestoreFailedException;
diff --git a/server/src/main/java/org/opensearch/rest/RestResponse.java b/server/src/main/java/org/opensearch/rest/RestResponse.java
index bbf6e5d34bd01..afa7180d2abe6 100644
--- a/server/src/main/java/org/opensearch/rest/RestResponse.java
+++ b/server/src/main/java/org/opensearch/rest/RestResponse.java
@@ -34,6 +34,7 @@
import org.opensearch.OpenSearchException;
import org.opensearch.common.bytes.BytesReference;
+import org.opensearch.core.common.lease.Releasable;
import java.util.ArrayList;
import java.util.Collections;
@@ -57,7 +58,7 @@ public abstract class RestResponse {
public abstract String contentType();
/**
- * The response content. Note, if the content is {@link org.opensearch.common.lease.Releasable} it
+ * The response content. Note, if the content is {@link Releasable} it
* should automatically be released when done by the channel sending it.
*/
public abstract BytesReference content();
diff --git a/server/src/main/java/org/opensearch/search/DefaultSearchContext.java b/server/src/main/java/org/opensearch/search/DefaultSearchContext.java
index 40081c087f09a..ceca23944ce39 100644
--- a/server/src/main/java/org/opensearch/search/DefaultSearchContext.java
+++ b/server/src/main/java/org/opensearch/search/DefaultSearchContext.java
@@ -45,10 +45,10 @@
import org.opensearch.action.search.SearchType;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.search.Queries;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.BigArrays;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexSettings;
diff --git a/server/src/main/java/org/opensearch/search/SearchService.java b/server/src/main/java/org/opensearch/search/SearchService.java
index efb5800879495..12584a5d6d708 100644
--- a/server/src/main/java/org/opensearch/search/SearchService.java
+++ b/server/src/main/java/org/opensearch/search/SearchService.java
@@ -58,8 +58,6 @@
import org.opensearch.common.component.AbstractLifecycleComponent;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
@@ -70,6 +68,8 @@
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.util.concurrent.ConcurrentMapLong;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.Index;
import org.opensearch.index.IndexNotFoundException;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/Aggregator.java b/server/src/main/java/org/opensearch/search/aggregations/Aggregator.java
index 4d9b973e4550f..72ebc0d2cf087 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/Aggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/Aggregator.java
@@ -37,7 +37,7 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.xcontent.DeprecationHandler;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.core.xcontent.XContentParser;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java
index 67af0b13eed3b..89db461338eab 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java
@@ -32,9 +32,9 @@
package org.opensearch.search.aggregations.bucket;
import org.apache.lucene.index.LeafReaderContext;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.aggregations.AggregationExecutionException;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorBase;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/BinaryValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/BinaryValuesSource.java
index 54fd261f88c35..1f2609f1ea871 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/BinaryValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/BinaryValuesSource.java
@@ -39,9 +39,9 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
import org.opensearch.common.CheckedFunction;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.StringFieldType;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeAggregator.java
index 8b487fc499602..c7e27f672ef4a 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeAggregator.java
@@ -57,7 +57,7 @@
import org.apache.lucene.search.comparators.LongComparator;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.RoaringDocIdSet;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexSortConfig;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java
index 6ee1682a7b196..43f5ddd203953 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java
@@ -35,10 +35,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.CollectionTerminatedException;
import org.apache.lucene.util.PriorityQueue;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.LeafBucketCollector;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/DoubleValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/DoubleValuesSource.java
index 970f07b6a9d74..0af2266509dd3 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/DoubleValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/DoubleValuesSource.java
@@ -36,10 +36,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.Query;
import org.opensearch.common.CheckedFunction;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java
index 3e5c53d470f79..57038372672d8 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java
@@ -39,9 +39,9 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.opensearch.common.CheckedFunction;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.StringFieldType;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/LongValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/LongValuesSource.java
index 48e080c1576dd..5b3db1b48d653 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/LongValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/LongValuesSource.java
@@ -45,10 +45,10 @@
import org.apache.lucene.search.PointRangeQuery;
import org.apache.lucene.search.Query;
import org.opensearch.common.CheckedFunction;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.mapper.DateFieldMapper;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.NumberFieldMapper;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java
index fe0801d6d230e..30fedac53691f 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java
@@ -36,8 +36,8 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.Query;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.BigArrays;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.LeafBucketCollector;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/UnsignedLongValuesSource.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/UnsignedLongValuesSource.java
index 797b61f46240e..1c5d9aacc1ad0 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/UnsignedLongValuesSource.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/UnsignedLongValuesSource.java
@@ -15,10 +15,10 @@
import org.apache.lucene.search.Query;
import org.opensearch.common.CheckedFunction;
import org.opensearch.common.Numbers;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.NumberFieldMapper;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AbstractHistogramAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AbstractHistogramAggregator.java
index d3a4a51e5b6f2..fdbed59ad2ab6 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AbstractHistogramAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AbstractHistogramAggregator.java
@@ -33,7 +33,7 @@
package org.opensearch.search.aggregations.bucket.histogram;
import org.apache.lucene.util.CollectionUtil;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregator.java
index ec3c8ed5207a4..b92d16cfb540a 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregator.java
@@ -37,10 +37,10 @@
import org.apache.lucene.util.CollectionUtil;
import org.opensearch.common.Rounding;
import org.opensearch.common.Rounding.Prepared;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.ByteArray;
import org.opensearch.common.util.IntArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateHistogramAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateHistogramAggregator.java
index 040621ce8ec34..7c548bf331f55 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateHistogramAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateHistogramAggregator.java
@@ -37,7 +37,7 @@
import org.apache.lucene.util.CollectionUtil;
import org.opensearch.common.Nullable;
import org.opensearch.common.Rounding;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateRangeHistogramAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateRangeHistogramAggregator.java
index f70a5bb537300..46b1abfd9645c 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateRangeHistogramAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/DateRangeHistogramAggregator.java
@@ -37,7 +37,7 @@
import org.apache.lucene.util.CollectionUtil;
import org.opensearch.common.Nullable;
import org.opensearch.common.Rounding;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.index.mapper.RangeFieldMapper;
import org.opensearch.index.mapper.RangeType;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregator.java
index 11ff7dbc407cb..70e496b582008 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/histogram/VariableWidthHistogramAggregator.java
@@ -37,10 +37,10 @@
import org.apache.lucene.util.CollectionUtil;
import org.apache.lucene.util.InPlaceMergeSorter;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/BestDocsDeferringCollector.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/BestDocsDeferringCollector.java
index 080142185f82e..d4eca59b6b621 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/BestDocsDeferringCollector.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/BestDocsDeferringCollector.java
@@ -42,10 +42,10 @@
import org.apache.lucene.search.TopScoreDocCollector;
import org.apache.lucene.util.RamUsageEstimator;
import org.opensearch.OpenSearchException;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.BucketCollector;
import org.opensearch.search.aggregations.LeafBucketCollector;
import org.opensearch.search.aggregations.MultiBucketCollector;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedMapSamplerAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedMapSamplerAggregator.java
index cb880759887e4..8b163f1d7fd50 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedMapSamplerAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedMapSamplerAggregator.java
@@ -39,8 +39,8 @@
import org.apache.lucene.search.TopDocsCollector;
import org.apache.lucene.util.BytesRef;
import org.opensearch.OpenSearchException;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BytesRefHash;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.AbstractNumericDocValues;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregator.java
index d9fe50b50508c..a1dac28486ccd 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregator.java
@@ -35,9 +35,9 @@
import org.apache.lucene.misc.search.DiversifiedTopDocsCollector;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.util.RamUsageEstimator;
-import org.opensearch.core.ParseField;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
+import org.opensearch.core.ParseField;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.AggregationExecutionException;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/BytesKeyedBucketOrds.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/BytesKeyedBucketOrds.java
index 0eb23013d1e47..a6941bfae73ab 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/BytesKeyedBucketOrds.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/BytesKeyedBucketOrds.java
@@ -33,10 +33,10 @@
package org.opensearch.search.aggregations.bucket.terms;
import org.apache.lucene.util.BytesRef;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BytesRefHash;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.aggregations.CardinalityUpperBound;
/**
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
index 396cc639f48fc..e82194587edd7 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
@@ -41,10 +41,10 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.PriorityQueue;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.LongArray;
import org.opensearch.common.util.LongHash;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.AggregationExecutionException;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongKeyedBucketOrds.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongKeyedBucketOrds.java
index bcf77ee194ea4..7ad03b2153a2e 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongKeyedBucketOrds.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongKeyedBucketOrds.java
@@ -32,10 +32,10 @@
package org.opensearch.search.aggregations.bucket.terms;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.LongHash;
import org.opensearch.common.util.LongLongHash;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.aggregations.CardinalityUpperBound;
/**
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongRareTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongRareTermsAggregator.java
index 6e4cd895e7496..22c4d372dc0db 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongRareTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/LongRareTermsAggregator.java
@@ -33,9 +33,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.LongHash;
import org.opensearch.common.util.SetBackedScalingCuckooFilter;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.AggregatorFactories;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MapStringTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MapStringTermsAggregator.java
index 8ef33667e972c..8991b1c55d7b8 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MapStringTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MapStringTermsAggregator.java
@@ -36,9 +36,9 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.PriorityQueue;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MultiTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MultiTermsAggregator.java
index c810ba8f38624..64e635e020f7a 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MultiTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/MultiTermsAggregator.java
@@ -21,7 +21,7 @@
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java
index b03f7770997ba..9cbe454a7b8e4 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java
@@ -38,9 +38,9 @@
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.PriorityQueue;
import org.opensearch.common.Numbers;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.FieldData;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java
index aee4caa67afa1..e484383b4a9b3 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java
@@ -42,13 +42,13 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.BytesRef;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.index.FilterableTermsEnum;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BytesRefHash;
import org.opensearch.common.util.LongArray;
import org.opensearch.common.util.LongHash;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.query.QueryBuilder;
import org.opensearch.index.query.QueryShardContext;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificantTextAggregatorFactory.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificantTextAggregatorFactory.java
index 39711cf0901f5..f318c045e46a8 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificantTextAggregatorFactory.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificantTextAggregatorFactory.java
@@ -40,10 +40,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BytesRefHash;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.query.QueryBuilder;
import org.opensearch.index.query.QueryShardContext;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/StringRareTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/StringRareTermsAggregator.java
index c796faa6a8b76..c57f2f6d7f2ce 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/StringRareTermsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/StringRareTermsAggregator.java
@@ -34,9 +34,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BytesRefHash;
import org.opensearch.common.util.SetBackedScalingCuckooFilter;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHDRPercentilesAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHDRPercentilesAggregator.java
index a0d86b382eef0..18324995458d0 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHDRPercentilesAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHDRPercentilesAggregator.java
@@ -35,10 +35,11 @@
import org.HdrHistogram.DoubleHistogram;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.ArrayUtils;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
+
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHyperLogLogPlusPlus.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHyperLogLogPlusPlus.java
index 4ea9c48e360ef..d1e850f23e1ce 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHyperLogLogPlusPlus.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractHyperLogLogPlusPlus.java
@@ -34,8 +34,8 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.BigArrays;
+import org.opensearch.core.common.lease.Releasable;
import java.io.IOException;
import java.util.HashMap;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractTDigestPercentilesAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractTDigestPercentilesAggregator.java
index 8c79a80a26b9e..09640e25d3b8d 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractTDigestPercentilesAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/AbstractTDigestPercentilesAggregator.java
@@ -34,10 +34,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.ArrayUtils;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/AvgAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/AvgAggregator.java
index e58466b56df2a..e1c853f707ff0 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/AvgAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/AvgAggregator.java
@@ -33,10 +33,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/CardinalityAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/CardinalityAggregator.java
index a93f1a86c421e..89ff05af049d6 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/CardinalityAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/CardinalityAggregator.java
@@ -42,12 +42,12 @@
import org.apache.lucene.util.RamUsageEstimator;
import org.opensearch.common.Nullable;
import org.opensearch.common.hash.MurmurHash3;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.LongArray;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/ExtendedStatsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/ExtendedStatsAggregator.java
index 0c0863872aa7c..64b2b70982b7a 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/ExtendedStatsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/ExtendedStatsAggregator.java
@@ -33,11 +33,11 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.core.ParseField;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.ParseField;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/GeoCentroidAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/GeoCentroidAggregator.java
index 656211608433a..58536e8926804 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/GeoCentroidAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/GeoCentroidAggregator.java
@@ -34,10 +34,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.opensearch.common.geo.GeoPoint;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.MultiGeoPointValues;
import org.opensearch.search.aggregations.Aggregator;
import org.opensearch.search.aggregations.InternalAggregation;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlus.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlus.java
index d44454112e7eb..8c73bb91d5159 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlus.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlus.java
@@ -34,13 +34,13 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.packed.PackedInts;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.ByteArray;
import org.opensearch.common.util.ByteUtils;
import org.opensearch.common.util.IntArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlusSparse.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlusSparse.java
index 252df7358ddcd..702f10e5b39e7 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlusSparse.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlusSparse.java
@@ -32,10 +32,10 @@
package org.opensearch.search.aggregations.metrics;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.IntArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
/**
* AbstractHyperLogLogPlusPlus instance that only supports linear counting. The maximum number of hashes supported
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/MaxAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/MaxAggregator.java
index 8108b8a726856..e3562ef99eeab 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/MaxAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/MaxAggregator.java
@@ -37,9 +37,9 @@
import org.apache.lucene.search.CollectionTerminatedException;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.util.Bits;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.NumericDoubleValues;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java
index 0b4684452a8dc..6358281fa1523 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java
@@ -35,9 +35,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/MinAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/MinAggregator.java
index 946057e42ac88..23b750dde74eb 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/MinAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/MinAggregator.java
@@ -37,9 +37,9 @@
import org.apache.lucene.search.CollectionTerminatedException;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.util.Bits;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.NumericDoubleValues;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/ScriptedMetricAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/ScriptedMetricAggregator.java
index 2a2943e93150f..674d735bfc187 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/ScriptedMetricAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/ScriptedMetricAggregator.java
@@ -37,9 +37,9 @@
import org.apache.lucene.search.ScoreMode;
import org.opensearch.common.Nullable;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.CollectionUtils;
import org.opensearch.common.util.ObjectArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.script.Script;
import org.opensearch.script.ScriptedMetricAggContexts;
import org.opensearch.script.ScriptedMetricAggContexts.MapScript;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/StatsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/StatsAggregator.java
index c52638fe4b9c6..577609095963e 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/StatsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/StatsAggregator.java
@@ -33,10 +33,10 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregator.java
index 4b8e882cd69bc..fb92b091f4968 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregator.java
@@ -33,9 +33,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/TopHitsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/TopHitsAggregator.java
index 414d2e6e99b43..f1f4c4acdf4b9 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/TopHitsAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/TopHitsAggregator.java
@@ -50,10 +50,10 @@
import org.apache.lucene.search.TotalHits;
import org.opensearch.OpenSearchException;
import org.opensearch.action.search.MaxScoreCollector;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.search.TopDocsAndMaxScore;
import org.opensearch.common.util.LongObjectPagedHashMap;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.SearchHit;
import org.opensearch.search.SearchHits;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/ValueCountAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/ValueCountAggregator.java
index be98df384fc28..e6d4d09403689 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/ValueCountAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/ValueCountAggregator.java
@@ -34,9 +34,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.MultiGeoPointValues;
import org.opensearch.index.fielddata.SortedBinaryDocValues;
import org.opensearch.search.aggregations.Aggregator;
diff --git a/server/src/main/java/org/opensearch/search/aggregations/metrics/WeightedAvgAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/metrics/WeightedAvgAggregator.java
index d85ee651cb5e0..bf752711fa30f 100644
--- a/server/src/main/java/org/opensearch/search/aggregations/metrics/WeightedAvgAggregator.java
+++ b/server/src/main/java/org/opensearch/search/aggregations/metrics/WeightedAvgAggregator.java
@@ -33,9 +33,9 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.ScoreMode;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.DoubleArray;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.fielddata.SortedNumericDoubleValues;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.aggregations.AggregationExecutionException;
diff --git a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java
index 79b1b8ebce192..cf21712fc912a 100644
--- a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java
+++ b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java
@@ -62,8 +62,8 @@
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.CombinedBitSet;
import org.apache.lucene.util.SparseFixedBitSet;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.search.TopDocsAndMaxScore;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.DocValueFormat;
import org.opensearch.search.SearchService;
import org.opensearch.search.dfs.AggregatedDfs;
diff --git a/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java b/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java
index 5c2a9f82f98e4..0d60df27a6b85 100644
--- a/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java
+++ b/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java
@@ -10,8 +10,8 @@
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.SetOnce;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexService;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.engine.Segment;
diff --git a/server/src/main/java/org/opensearch/search/internal/ReaderContext.java b/server/src/main/java/org/opensearch/search/internal/ReaderContext.java
index 898aa2e2c6745..46adbf136a150 100644
--- a/server/src/main/java/org/opensearch/search/internal/ReaderContext.java
+++ b/server/src/main/java/org/opensearch/search/internal/ReaderContext.java
@@ -32,9 +32,9 @@
package org.opensearch.search.internal;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.concurrent.AbstractRefCounted;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.IndexService;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.shard.IndexShard;
diff --git a/server/src/main/java/org/opensearch/search/internal/SearchContext.java b/server/src/main/java/org/opensearch/search/internal/SearchContext.java
index 76d0d7b72c6b4..1daff856f82b1 100644
--- a/server/src/main/java/org/opensearch/search/internal/SearchContext.java
+++ b/server/src/main/java/org/opensearch/search/internal/SearchContext.java
@@ -38,10 +38,10 @@
import org.opensearch.action.search.SearchShardTask;
import org.opensearch.action.search.SearchType;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.BigArrays;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.cache.bitset.BitsetFilterCache;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.MapperService;
diff --git a/server/src/main/java/org/opensearch/search/sort/BucketedSort.java b/server/src/main/java/org/opensearch/search/sort/BucketedSort.java
index 0b8cfba736d33..3d598ab60259e 100644
--- a/server/src/main/java/org/opensearch/search/sort/BucketedSort.java
+++ b/server/src/main/java/org/opensearch/search/sort/BucketedSort.java
@@ -34,8 +34,6 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.Scorable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.ScorerAware;
import org.opensearch.common.util.BigArray;
import org.opensearch.common.util.BigArrays;
@@ -44,6 +42,8 @@
import org.opensearch.common.util.FloatArray;
import org.opensearch.common.util.IntArray;
import org.opensearch.common.util.LongArray;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.search.DocValueFormat;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/tasks/TaskManager.java b/server/src/main/java/org/opensearch/tasks/TaskManager.java
index 816ed391b9c7d..1d0e19e7a557b 100644
--- a/server/src/main/java/org/opensearch/tasks/TaskManager.java
+++ b/server/src/main/java/org/opensearch/tasks/TaskManager.java
@@ -50,8 +50,6 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.node.DiscoveryNodes;
import org.opensearch.common.SetOnce;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
@@ -61,6 +59,8 @@
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.util.concurrent.ConcurrentMapLong;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TcpChannel;
diff --git a/server/src/main/java/org/opensearch/transport/InboundAggregator.java b/server/src/main/java/org/opensearch/transport/InboundAggregator.java
index c8cfaa8339e33..1aebbae7b37cd 100644
--- a/server/src/main/java/org/opensearch/transport/InboundAggregator.java
+++ b/server/src/main/java/org/opensearch/transport/InboundAggregator.java
@@ -38,8 +38,8 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.bytes.CompositeBytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/server/src/main/java/org/opensearch/transport/InboundDecoder.java b/server/src/main/java/org/opensearch/transport/InboundDecoder.java
index cbc583aec762c..3196b0715c942 100644
--- a/server/src/main/java/org/opensearch/transport/InboundDecoder.java
+++ b/server/src/main/java/org/opensearch/transport/InboundDecoder.java
@@ -36,9 +36,9 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import java.io.IOException;
import java.util.function.Consumer;
diff --git a/server/src/main/java/org/opensearch/transport/InboundMessage.java b/server/src/main/java/org/opensearch/transport/InboundMessage.java
index 1809b000f705c..0b82e4d746990 100644
--- a/server/src/main/java/org/opensearch/transport/InboundMessage.java
+++ b/server/src/main/java/org/opensearch/transport/InboundMessage.java
@@ -34,9 +34,9 @@
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/transport/InboundPipeline.java b/server/src/main/java/org/opensearch/transport/InboundPipeline.java
index aeb2e228d125c..d20b15059936e 100644
--- a/server/src/main/java/org/opensearch/transport/InboundPipeline.java
+++ b/server/src/main/java/org/opensearch/transport/InboundPipeline.java
@@ -36,9 +36,9 @@
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.bytes.CompositeBytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.io.IOException;
import java.util.ArrayDeque;
diff --git a/server/src/main/java/org/opensearch/transport/OutboundHandler.java b/server/src/main/java/org/opensearch/transport/OutboundHandler.java
index 785faec543023..8d7217e4cd1f0 100644
--- a/server/src/main/java/org/opensearch/transport/OutboundHandler.java
+++ b/server/src/main/java/org/opensearch/transport/OutboundHandler.java
@@ -42,14 +42,14 @@
import org.opensearch.common.CheckedSupplier;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.ReleasableBytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.network.CloseableChannel;
import org.opensearch.common.transport.NetworkExceptionHelper;
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.threadpool.ThreadPool;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/transport/RequestHandlerRegistry.java b/server/src/main/java/org/opensearch/transport/RequestHandlerRegistry.java
index dbd6f651a6b3c..83bdf185b8a5f 100644
--- a/server/src/main/java/org/opensearch/transport/RequestHandlerRegistry.java
+++ b/server/src/main/java/org/opensearch/transport/RequestHandlerRegistry.java
@@ -34,10 +34,10 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
-import org.opensearch.search.internal.ShardSearchRequest;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
+import org.opensearch.search.internal.ShardSearchRequest;
import org.opensearch.tasks.CancellableTask;
import org.opensearch.tasks.Task;
import org.opensearch.tasks.TaskManager;
diff --git a/server/src/main/java/org/opensearch/transport/TaskTransportChannel.java b/server/src/main/java/org/opensearch/transport/TaskTransportChannel.java
index 4dceee4c48d4d..6fcef7619a703 100644
--- a/server/src/main/java/org/opensearch/transport/TaskTransportChannel.java
+++ b/server/src/main/java/org/opensearch/transport/TaskTransportChannel.java
@@ -33,7 +33,7 @@
package org.opensearch.transport;
import org.opensearch.Version;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/transport/TcpTransportChannel.java b/server/src/main/java/org/opensearch/transport/TcpTransportChannel.java
index e25003648794d..b396d63b99eb8 100644
--- a/server/src/main/java/org/opensearch/transport/TcpTransportChannel.java
+++ b/server/src/main/java/org/opensearch/transport/TcpTransportChannel.java
@@ -33,7 +33,7 @@
package org.opensearch.transport;
import org.opensearch.Version;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.query.QuerySearchResult;
import java.io.IOException;
diff --git a/server/src/main/java/org/opensearch/transport/TransportService.java b/server/src/main/java/org/opensearch/transport/TransportService.java
index 84c13d5f89067..0a31d2dbf6ec5 100644
--- a/server/src/main/java/org/opensearch/transport/TransportService.java
+++ b/server/src/main/java/org/opensearch/transport/TransportService.java
@@ -47,7 +47,6 @@
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Streamables;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.logging.Loggers;
import org.opensearch.common.regex.Regex;
import org.opensearch.common.settings.ClusterSettings;
@@ -58,6 +57,7 @@
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.common.Strings;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.node.NodeClosedException;
diff --git a/server/src/test/java/org/opensearch/ExceptionSerializationTests.java b/server/src/test/java/org/opensearch/ExceptionSerializationTests.java
index f8962f84362f1..a01ffc71b1675 100644
--- a/server/src/test/java/org/opensearch/ExceptionSerializationTests.java
+++ b/server/src/test/java/org/opensearch/ExceptionSerializationTests.java
@@ -893,7 +893,7 @@ public void testIds() {
}
}
- for (final Tuple> tuple : OpenSearchException.classes()) {
+ for (final Tuple> tuple : OpenSearchException.classes()) {
assertNotNull(tuple.v1());
assertNotNull(
tuple.v2().getName() + " not found in ExceptionSerializationTests.testIds. Please add it.",
diff --git a/server/src/test/java/org/opensearch/action/admin/cluster/node/tasks/TaskManagerTestCase.java b/server/src/test/java/org/opensearch/action/admin/cluster/node/tasks/TaskManagerTestCase.java
index 4eba00e95b77c..010524e1fed66 100644
--- a/server/src/test/java/org/opensearch/action/admin/cluster/node/tasks/TaskManagerTestCase.java
+++ b/server/src/test/java/org/opensearch/action/admin/cluster/node/tasks/TaskManagerTestCase.java
@@ -50,12 +50,12 @@
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.network.NetworkService;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.transport.BoundTransportAddress;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.tasks.TaskCancellationService;
import org.opensearch.tasks.TaskManager;
diff --git a/server/src/test/java/org/opensearch/action/resync/TransportResyncReplicationActionTests.java b/server/src/test/java/org/opensearch/action/resync/TransportResyncReplicationActionTests.java
index d6d944b5b9b45..39dfde96c0fdf 100644
--- a/server/src/test/java/org/opensearch/action/resync/TransportResyncReplicationActionTests.java
+++ b/server/src/test/java/org/opensearch/action/resync/TransportResyncReplicationActionTests.java
@@ -49,11 +49,11 @@
import org.opensearch.cluster.routing.ShardRoutingState;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.network.NetworkService;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexSettings;
diff --git a/server/src/test/java/org/opensearch/action/search/MockSearchPhaseContext.java b/server/src/test/java/org/opensearch/action/search/MockSearchPhaseContext.java
index e078b4a467e91..799387573b514 100644
--- a/server/src/test/java/org/opensearch/action/search/MockSearchPhaseContext.java
+++ b/server/src/test/java/org/opensearch/action/search/MockSearchPhaseContext.java
@@ -36,8 +36,8 @@
import org.opensearch.Version;
import org.opensearch.action.OriginalIndices;
import org.opensearch.common.Nullable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AtomicArray;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.search.SearchPhaseResult;
import org.opensearch.search.SearchShardTarget;
import org.opensearch.search.internal.InternalSearchResponse;
diff --git a/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationActionTests.java b/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationActionTests.java
index baae2b31916b3..cb39e5e0ce8c5 100644
--- a/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationActionTests.java
+++ b/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationActionTests.java
@@ -73,10 +73,10 @@
import org.opensearch.common.io.stream.NamedWriteableRegistry;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.network.NetworkService;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexNotFoundException;
import org.opensearch.index.IndexService;
diff --git a/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java b/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java
index 013be1f2ebd42..b82cc6510f94a 100644
--- a/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java
+++ b/server/src/test/java/org/opensearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java
@@ -55,9 +55,9 @@
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.SetOnce;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexService;
import org.opensearch.index.engine.InternalEngineFactory;
import org.opensearch.index.shard.IndexShard;
diff --git a/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionForIndexingPressureTests.java b/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionForIndexingPressureTests.java
index 3aae1ee40818d..0db21af565b86 100644
--- a/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionForIndexingPressureTests.java
+++ b/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionForIndexingPressureTests.java
@@ -19,9 +19,9 @@
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.Nullable;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexingPressureService;
diff --git a/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionTests.java b/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionTests.java
index 137aca4966936..18d003b1eb79b 100644
--- a/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionTests.java
+++ b/server/src/test/java/org/opensearch/action/support/replication/TransportWriteActionTests.java
@@ -52,8 +52,8 @@
import org.opensearch.cluster.routing.TestShardRouting;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexingPressureService;
diff --git a/server/src/test/java/org/opensearch/cluster/coordination/ElectionSchedulerFactoryTests.java b/server/src/test/java/org/opensearch/cluster/coordination/ElectionSchedulerFactoryTests.java
index 164f802fdae38..2ebf099f2b0cb 100644
--- a/server/src/test/java/org/opensearch/cluster/coordination/ElectionSchedulerFactoryTests.java
+++ b/server/src/test/java/org/opensearch/cluster/coordination/ElectionSchedulerFactoryTests.java
@@ -32,10 +32,10 @@
package org.opensearch.cluster.coordination;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.Settings.Builder;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.test.OpenSearchTestCase;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/server/src/test/java/org/opensearch/cluster/coordination/PreVoteCollectorTests.java b/server/src/test/java/org/opensearch/cluster/coordination/PreVoteCollectorTests.java
index d399a9296746e..19e400e27ab00 100644
--- a/server/src/test/java/org/opensearch/cluster/coordination/PreVoteCollectorTests.java
+++ b/server/src/test/java/org/opensearch/cluster/coordination/PreVoteCollectorTests.java
@@ -37,8 +37,8 @@
import org.opensearch.cluster.coordination.CoordinationMetadata.VotingConfiguration;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.monitor.StatusInfo;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.transport.MockTransport;
diff --git a/server/src/test/java/org/opensearch/cluster/service/TaskExecutorTests.java b/server/src/test/java/org/opensearch/cluster/service/TaskExecutorTests.java
index 28905c570ebfe..08c989de647b8 100644
--- a/server/src/test/java/org/opensearch/cluster/service/TaskExecutorTests.java
+++ b/server/src/test/java/org/opensearch/cluster/service/TaskExecutorTests.java
@@ -35,11 +35,11 @@
import org.opensearch.cluster.metadata.ProcessClusterEventTimeoutException;
import org.opensearch.common.Nullable;
import org.opensearch.common.Priority;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
import org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.TestThreadPool;
import org.opensearch.threadpool.ThreadPool;
diff --git a/server/src/test/java/org/opensearch/common/ReleasablesTests.java b/server/src/test/java/org/opensearch/common/ReleasablesTests.java
index d9f561d079054..b9739a26b7b1c 100644
--- a/server/src/test/java/org/opensearch/common/ReleasablesTests.java
+++ b/server/src/test/java/org/opensearch/common/ReleasablesTests.java
@@ -31,9 +31,9 @@
package org.opensearch.common;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.test.OpenSearchTestCase;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/server/src/test/java/org/opensearch/common/util/BinarySearcherTests.java b/server/src/test/java/org/opensearch/common/util/BinarySearcherTests.java
index fc441d63fc0b3..294426c37f7af 100644
--- a/server/src/test/java/org/opensearch/common/util/BinarySearcherTests.java
+++ b/server/src/test/java/org/opensearch/common/util/BinarySearcherTests.java
@@ -32,8 +32,8 @@
package org.opensearch.common.util;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before;
diff --git a/server/src/test/java/org/opensearch/common/util/concurrent/KeyedLockTests.java b/server/src/test/java/org/opensearch/common/util/concurrent/KeyedLockTests.java
index 77969e042c98d..8746c9ab72e91 100644
--- a/server/src/test/java/org/opensearch/common/util/concurrent/KeyedLockTests.java
+++ b/server/src/test/java/org/opensearch/common/util/concurrent/KeyedLockTests.java
@@ -32,7 +32,7 @@
package org.opensearch.common.util.concurrent;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers;
diff --git a/server/src/test/java/org/opensearch/common/util/concurrent/ReleasableLockTests.java b/server/src/test/java/org/opensearch/common/util/concurrent/ReleasableLockTests.java
index 7f7667f4db9a5..d22ef45e0aaf5 100644
--- a/server/src/test/java/org/opensearch/common/util/concurrent/ReleasableLockTests.java
+++ b/server/src/test/java/org/opensearch/common/util/concurrent/ReleasableLockTests.java
@@ -32,8 +32,8 @@
package org.opensearch.common.util.concurrent;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.test.OpenSearchTestCase;
import java.util.ArrayList;
diff --git a/server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java b/server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java
index 9dab01448db8d..f5748713e8887 100644
--- a/server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java
+++ b/server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java
@@ -38,14 +38,14 @@
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.ReleasableBytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.ByteArray;
import org.opensearch.common.util.MockBigArrays;
import org.opensearch.common.util.MockPageCacheRecycler;
-import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.json.JsonXContent;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.rest.BytesRestResponse;
import org.opensearch.rest.RestChannel;
diff --git a/server/src/test/java/org/opensearch/index/IndexingPressureServiceTests.java b/server/src/test/java/org/opensearch/index/IndexingPressureServiceTests.java
index 22d185643018a..a41b8b4d3ca74 100644
--- a/server/src/test/java/org/opensearch/index/IndexingPressureServiceTests.java
+++ b/server/src/test/java/org/opensearch/index/IndexingPressureServiceTests.java
@@ -18,9 +18,9 @@
import org.opensearch.action.support.WriteRequest;
import org.opensearch.client.Requests;
import org.opensearch.cluster.service.ClusterService;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.ShardId;
import org.opensearch.index.stats.IndexingPressurePerShardStats;
import org.opensearch.index.stats.IndexingPressureStats;
diff --git a/server/src/test/java/org/opensearch/index/IndexingPressureTests.java b/server/src/test/java/org/opensearch/index/IndexingPressureTests.java
index 1aa20506222d1..69fc23b1293ad 100644
--- a/server/src/test/java/org/opensearch/index/IndexingPressureTests.java
+++ b/server/src/test/java/org/opensearch/index/IndexingPressureTests.java
@@ -32,8 +32,8 @@
package org.opensearch.index;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.stats.IndexingPressureStats;
import org.opensearch.test.OpenSearchTestCase;
diff --git a/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java b/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java
index 170919fbf351c..13874828caa90 100644
--- a/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java
+++ b/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java
@@ -13,9 +13,9 @@
import org.hamcrest.Matchers;
import org.opensearch.action.admin.indices.stats.CommonStatsFlags;
import org.opensearch.cluster.service.ClusterService;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.ShardId;
import org.opensearch.index.stats.IndexingPressurePerShardStats;
diff --git a/server/src/test/java/org/opensearch/index/ShardIndexingPressureTests.java b/server/src/test/java/org/opensearch/index/ShardIndexingPressureTests.java
index 77593660a7d12..6ced3e0149016 100644
--- a/server/src/test/java/org/opensearch/index/ShardIndexingPressureTests.java
+++ b/server/src/test/java/org/opensearch/index/ShardIndexingPressureTests.java
@@ -9,7 +9,7 @@
package org.opensearch.index;
import org.opensearch.cluster.service.ClusterService;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
diff --git a/server/src/test/java/org/opensearch/index/engine/LiveVersionMapTests.java b/server/src/test/java/org/opensearch/index/engine/LiveVersionMapTests.java
index b1e033232420b..16c07104b5035 100644
--- a/server/src/test/java/org/opensearch/index/engine/LiveVersionMapTests.java
+++ b/server/src/test/java/org/opensearch/index/engine/LiveVersionMapTests.java
@@ -37,7 +37,7 @@
import org.apache.lucene.util.Constants;
import org.apache.lucene.tests.util.RamUsageTester;
import org.apache.lucene.tests.util.TestUtil;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.translog.Translog;
import org.opensearch.test.OpenSearchTestCase;
diff --git a/server/src/test/java/org/opensearch/index/engine/SoftDeletesPolicyTests.java b/server/src/test/java/org/opensearch/index/engine/SoftDeletesPolicyTests.java
index 07d49b25595b4..643d4cd28da6e 100644
--- a/server/src/test/java/org/opensearch/index/engine/SoftDeletesPolicyTests.java
+++ b/server/src/test/java/org/opensearch/index/engine/SoftDeletesPolicyTests.java
@@ -35,7 +35,7 @@
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.search.PointRangeQuery;
import org.apache.lucene.search.Query;
-import org.opensearch.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.seqno.RetentionLease;
import org.opensearch.index.seqno.RetentionLeases;
import org.opensearch.test.OpenSearchTestCase;
diff --git a/server/src/test/java/org/opensearch/index/replication/RecoveryDuringReplicationTests.java b/server/src/test/java/org/opensearch/index/replication/RecoveryDuringReplicationTests.java
index 0b976154969dc..5ac10824e14e2 100644
--- a/server/src/test/java/org/opensearch/index/replication/RecoveryDuringReplicationTests.java
+++ b/server/src/test/java/org/opensearch/index/replication/RecoveryDuringReplicationTests.java
@@ -47,10 +47,10 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.common.bytes.BytesArray;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.VersionType;
import org.opensearch.index.engine.DocIdSeqNoAndSource;
diff --git a/server/src/test/java/org/opensearch/index/seqno/RetentionLeaseActionsTests.java b/server/src/test/java/org/opensearch/index/seqno/RetentionLeaseActionsTests.java
index 1a52fd2de39e0..73513d776464f 100644
--- a/server/src/test/java/org/opensearch/index/seqno/RetentionLeaseActionsTests.java
+++ b/server/src/test/java/org/opensearch/index/seqno/RetentionLeaseActionsTests.java
@@ -36,9 +36,9 @@
import org.opensearch.action.admin.indices.stats.IndicesStatsAction;
import org.opensearch.action.admin.indices.stats.IndicesStatsRequest;
import org.opensearch.action.admin.indices.stats.IndicesStatsResponse;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.shard.ShardId;
diff --git a/server/src/test/java/org/opensearch/index/shard/IndexShardOperationPermitsTests.java b/server/src/test/java/org/opensearch/index/shard/IndexShardOperationPermitsTests.java
index 1e09ae56f0049..4dcab737787aa 100644
--- a/server/src/test/java/org/opensearch/index/shard/IndexShardOperationPermitsTests.java
+++ b/server/src/test/java/org/opensearch/index/shard/IndexShardOperationPermitsTests.java
@@ -34,11 +34,11 @@
import org.opensearch.action.ActionListener;
import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.common.CheckedRunnable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
-import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.common.util.concurrent.OpenSearchThreadPoolExecutor;
import org.opensearch.common.util.concurrent.ThreadContext;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.TestThreadPool;
import org.opensearch.threadpool.ThreadPool;
diff --git a/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java b/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java
index 5253a017f8e0e..eb7ff360ec5d9 100644
--- a/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java
+++ b/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java
@@ -80,18 +80,18 @@
import org.opensearch.common.concurrent.GatedCloseable;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.IndexScopedSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.AtomicArray;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
-import org.opensearch.core.xcontent.NamedXContentRegistry;
-import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
+import org.opensearch.core.xcontent.NamedXContentRegistry;
+import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.codec.CodecService;
diff --git a/server/src/test/java/org/opensearch/index/shard/RefreshListenersTests.java b/server/src/test/java/org/opensearch/index/shard/RefreshListenersTests.java
index 9bb36bc32639a..39c91ffa5f482 100644
--- a/server/src/test/java/org/opensearch/index/shard/RefreshListenersTests.java
+++ b/server/src/test/java/org/opensearch/index/shard/RefreshListenersTests.java
@@ -44,7 +44,6 @@
import org.opensearch.common.UUIDs;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.bytes.BytesReference;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.metrics.MeanMetric;
import org.opensearch.common.settings.Settings;
@@ -53,6 +52,7 @@
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.Index;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.codec.CodecService;
diff --git a/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java b/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java
index 365fb0237f80f..e300cf84d34fd 100644
--- a/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java
+++ b/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java
@@ -21,9 +21,9 @@
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.engine.InternalEngineFactory;
import org.opensearch.index.remote.RemoteRefreshSegmentPressureService;
import org.opensearch.index.remote.RemoteRefreshSegmentTracker;
diff --git a/server/src/test/java/org/opensearch/index/shard/SegmentReplicationIndexShardTests.java b/server/src/test/java/org/opensearch/index/shard/SegmentReplicationIndexShardTests.java
index 764d60dbd5b82..1d0bc4cd1910b 100644
--- a/server/src/test/java/org/opensearch/index/shard/SegmentReplicationIndexShardTests.java
+++ b/server/src/test/java/org/opensearch/index/shard/SegmentReplicationIndexShardTests.java
@@ -21,12 +21,12 @@
import org.opensearch.cluster.routing.ShardRoutingHelper;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.CancellableThreads;
import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.engine.DocIdSeqNoAndSource;
import org.opensearch.index.engine.InternalEngine;
diff --git a/server/src/test/java/org/opensearch/index/translog/TranslogDeletionPolicyTests.java b/server/src/test/java/org/opensearch/index/translog/TranslogDeletionPolicyTests.java
index e9f88d60247fb..fba68427285ed 100644
--- a/server/src/test/java/org/opensearch/index/translog/TranslogDeletionPolicyTests.java
+++ b/server/src/test/java/org/opensearch/index/translog/TranslogDeletionPolicyTests.java
@@ -36,9 +36,9 @@
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.io.stream.BytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.shard.ShardId;
import org.opensearch.test.OpenSearchTestCase;
import org.mockito.Mockito;
diff --git a/server/src/test/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandlerTests.java b/server/src/test/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandlerTests.java
index 39df2950d2552..cc691ba82c67c 100644
--- a/server/src/test/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandlerTests.java
+++ b/server/src/test/java/org/opensearch/indices/recovery/LocalStorePeerRecoverySourceHandlerTests.java
@@ -63,7 +63,6 @@
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.concurrent.GatedCloseable;
import org.opensearch.core.util.FileSystemUtils;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.store.IndexOutputOutputStream;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.settings.ClusterSettings;
@@ -73,6 +72,7 @@
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.engine.RecoveryEngineException;
diff --git a/server/src/test/java/org/opensearch/search/aggregations/metrics/InternalCardinalityTests.java b/server/src/test/java/org/opensearch/search/aggregations/metrics/InternalCardinalityTests.java
index e574b19d201fa..76cf2710553e5 100644
--- a/server/src/test/java/org/opensearch/search/aggregations/metrics/InternalCardinalityTests.java
+++ b/server/src/test/java/org/opensearch/search/aggregations/metrics/InternalCardinalityTests.java
@@ -33,10 +33,10 @@
package org.opensearch.search.aggregations.metrics;
import com.carrotsearch.hppc.BitMixer;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.MockBigArrays;
import org.opensearch.common.util.MockPageCacheRecycler;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.search.aggregations.ParsedAggregation;
import org.opensearch.test.InternalAggregationTestCase;
diff --git a/server/src/test/java/org/opensearch/search/sort/BucketedSortTestCase.java b/server/src/test/java/org/opensearch/search/sort/BucketedSortTestCase.java
index 8a51ddd29f17d..042089f85ced7 100644
--- a/server/src/test/java/org/opensearch/search/sort/BucketedSortTestCase.java
+++ b/server/src/test/java/org/opensearch/search/sort/BucketedSortTestCase.java
@@ -33,13 +33,13 @@
package org.opensearch.search.sort;
import org.apache.lucene.index.LeafReaderContext;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.BitArray;
import org.opensearch.common.util.IntArray;
import org.opensearch.common.util.MockBigArrays;
import org.opensearch.common.util.MockPageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.search.DocValueFormat;
import org.opensearch.test.OpenSearchTestCase;
diff --git a/server/src/test/java/org/opensearch/tasks/TaskManagerTests.java b/server/src/test/java/org/opensearch/tasks/TaskManagerTests.java
index ab49109eb8247..73da1ec6ffe48 100644
--- a/server/src/test/java/org/opensearch/tasks/TaskManagerTests.java
+++ b/server/src/test/java/org/opensearch/tasks/TaskManagerTests.java
@@ -34,11 +34,11 @@
import org.opensearch.action.ActionListener;
import org.opensearch.action.admin.cluster.node.tasks.TransportTasksActionTests;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.RunnableTaskExecutionListener;
import org.opensearch.threadpool.TestThreadPool;
diff --git a/server/src/test/java/org/opensearch/transport/InboundPipelineTests.java b/server/src/test/java/org/opensearch/transport/InboundPipelineTests.java
index 7be191e00d968..fbaac1a03bebe 100644
--- a/server/src/test/java/org/opensearch/transport/InboundPipelineTests.java
+++ b/server/src/test/java/org/opensearch/transport/InboundPipelineTests.java
@@ -42,12 +42,12 @@
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.io.stream.BytesStreamOutput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.io.Streams;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
diff --git a/server/src/test/java/org/opensearch/transport/TransportDecompressorTests.java b/server/src/test/java/org/opensearch/transport/TransportDecompressorTests.java
index 9bd746dd9e4c1..08308f80ab09d 100644
--- a/server/src/test/java/org/opensearch/transport/TransportDecompressorTests.java
+++ b/server/src/test/java/org/opensearch/transport/TransportDecompressorTests.java
@@ -41,8 +41,8 @@
import org.opensearch.common.io.stream.OutputStreamStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.util.PageCacheRecycler;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java
index b179d596f32f1..2e1891f94fabe 100644
--- a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java
+++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java
@@ -63,7 +63,6 @@
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
@@ -73,6 +72,7 @@
import org.opensearch.common.util.MockBigArrays;
import org.opensearch.common.util.MockPageCacheRecycler;
import org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.discovery.DiscoveryModule;
import org.opensearch.discovery.SeedHostsProvider;
import org.opensearch.env.NodeEnvironment;
diff --git a/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java b/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java
index e349fbdd6f1fc..9caaf09a217e4 100644
--- a/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java
+++ b/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java
@@ -75,12 +75,12 @@
import org.opensearch.common.collect.Iterators;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.xcontent.XContentType;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.index.Index;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.engine.DocIdSeqNoAndSource;
diff --git a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java
index b1dd4fb1dcc1e..9681c01688337 100644
--- a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java
+++ b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java
@@ -67,7 +67,6 @@
import org.opensearch.common.blobstore.fs.FsBlobStore;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.concurrent.GatedCloseable;
-import org.opensearch.common.lease.Releasable;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
@@ -75,6 +74,7 @@
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.index.Index;
import org.opensearch.index.IndexSettings;
diff --git a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java
index 9158d16446125..56a9455c7af34 100644
--- a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java
+++ b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java
@@ -65,14 +65,14 @@
import org.opensearch.common.TriFunction;
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.io.stream.StreamOutput;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
import org.opensearch.common.network.NetworkAddress;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.BigArrays;
import org.opensearch.common.util.MockBigArrays;
import org.opensearch.common.util.MockPageCacheRecycler;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.xcontent.ContextParser;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.index.Index;
diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
index c5241766bd808..3faf13c373720 100644
--- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
+++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java
@@ -71,7 +71,6 @@
import org.opensearch.common.breaker.CircuitBreaker;
import org.opensearch.common.component.LifecycleListener;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.settings.MockSecureSettings;
import org.opensearch.common.settings.SecureSettings;
import org.opensearch.common.settings.Settings;
@@ -85,6 +84,7 @@
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.set.Sets;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.core.common.Strings;
import org.opensearch.core.util.FileSystemUtils;
import org.opensearch.env.Environment;
diff --git a/test/framework/src/main/java/org/opensearch/test/transport/MockTransport.java b/test/framework/src/main/java/org/opensearch/test/transport/MockTransport.java
index 5bfc8879ecbc6..5b194a828a874 100644
--- a/test/framework/src/main/java/org/opensearch/test/transport/MockTransport.java
+++ b/test/framework/src/main/java/org/opensearch/test/transport/MockTransport.java
@@ -40,6 +40,7 @@
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
+import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.transport.BoundTransportAddress;
@@ -151,7 +152,7 @@ public void handleRemoteError(final long requestId, final Throwable t) {
} else {
try (BytesStreamOutput output = new BytesStreamOutput()) {
output.writeException(t);
- remoteException = new RemoteTransportException("remote failure", output.bytes().streamInput().readException());
+ remoteException = new RemoteTransportException("remote failure", output.bytes().streamInput().readException());
} catch (IOException ioException) {
throw new AssertionError("failed to serialize/deserialize supplied exception " + t, ioException);
}
diff --git a/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransport.java b/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransport.java
index a1f7f5fd2c901..aab513b31929b 100644
--- a/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransport.java
+++ b/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransport.java
@@ -45,14 +45,14 @@
import org.opensearch.common.bytes.CompositeBytesReference;
import org.opensearch.common.bytes.ReleasableBytesReference;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
-import org.opensearch.common.lease.Releasable;
-import org.opensearch.common.lease.Releasables;
import org.opensearch.common.network.NetworkService;
import org.opensearch.common.recycler.Recycler;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.common.util.io.IOUtils;
+import org.opensearch.core.common.lease.Releasable;
+import org.opensearch.core.common.lease.Releasables;
import org.opensearch.indices.breaker.CircuitBreakerService;
import org.opensearch.nio.BytesChannelContext;
import org.opensearch.nio.BytesWriteHandler;