diff --git a/CONFIGURATION.md b/CONFIGURATION.md
index febfe7c056..f2cbefd22c 100644
--- a/CONFIGURATION.md
+++ b/CONFIGURATION.md
@@ -31,7 +31,6 @@ Here are some Stargate-relevant property groups that are necessary for correct s
| `stargate.jsonapi.document.limits.max-property-path-length` | `int` | `250` | The maximum length of property paths in a document (segments and separating periods) |
| `stargate.jsonapi.document.limits.max-object-properties` | `int` | `1000` | The maximum number of properties any single object in a document can contain. |
| `stargate.jsonapi.document.limits.max-document-properties` | `int` | `2000` | The maximum total number of properties all objects in a document can contain. |
-| `stargate.jsonapi.document.limits.max-filter-object-properties` | `int` | `64` | The maximum number of properties a single filter clause can contain. |
| `stargate.jsonapi.document.limits.max-number-length` | `int` | `50` | The maximum length (in characters) of a single number value in a document. |
| `stargate.jsonapi.document.limits.max-string-length-in-bytes` | `int` | `8000` | The maximum length (in bytes) of a single string value in a document. |
| `stargate.jsonapi.document.limits.max-array-length` | `int` | `1000` | The maximum length (in elements) of a single array in a document. |
@@ -48,6 +47,7 @@ Here are some Stargate-relevant property groups that are necessary for correct s
| `stargate.jsonapi.operations.max-document-insert-count` | `int` | `20` | The maximum amount of documents that can be inserted in a single operation. The request will fail fast without inserts if the limit is broken. |
| `stargate.jsonapi.operations.max-document-update-count` | `int` | `20` | The maximum amount of documents that can be updated in a single operation. In case there are more documents that could be updated, the operation will set the `moreData` response status to `true`. |
| `stargate.jsonapi.operations.max-document-delete-count` | `int` | `20` | The maximum amount of documents that can be deleted in a single operation. In case there are more documents that could be deleted, the operation will set the `moreData` response status to `true`. |
+| `stargate.jsonapi.operations.max-filter-object-properties` | `int` | `64` | The maximum number of properties a single filter clause can contain. |
| `stargate.jsonapi.operations.max-in-operator-value-size` | `int` | `100` | The maximum number of _id values that can be passed for `$in` operator. |
| `stargate.jsonapi.operations.lwt.retries` | `int` | `3` | The amount of client side retries in case of a LWT failure. |
| `stargate.jsonapi.operations.database-config.session-cache-ttl-seconds` | `int` | `300` | The amount of seconds that the cql session will be kept in memory after last access. |
diff --git a/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java b/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java
index 36e4260544..d07ca52f35 100644
--- a/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java
+++ b/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java
@@ -12,10 +12,6 @@
@StaticInitSafe
@ConfigMapping(prefix = "stargate.jsonapi.document.limits")
public interface DocumentLimitsConfig {
-
- /** Defines the default max size of filter fields. */
- int DEFAULT_MAX_FILTER_SIZE = 64;
-
/** Defines the default maximum document size. */
int DEFAULT_MAX_DOCUMENT_SIZE = 1_000_000;
@@ -105,14 +101,6 @@ public interface DocumentLimitsConfig {
@WithDefault("" + DEFAULT_MAX_DOC_PROPERTIES)
int maxDocumentProperties();
- /**
- * @return Defines the max size of filter fields, defaults to {@code 64}. (note: this does not
- * count the fields in '$operation' such as $in, $all)
- */
- @Positive
- @WithDefault("" + DEFAULT_MAX_FILTER_SIZE)
- int maxFilterObjectProperties();
-
/** @return Defines the maximum length of a single Number value (in characters). */
@Positive
@WithDefault("" + DEFAULT_MAX_NUMBER_LENGTH)
diff --git a/src/main/java/io/stargate/sgv2/jsonapi/config/OperationsConfig.java b/src/main/java/io/stargate/sgv2/jsonapi/config/OperationsConfig.java
index 2612ac4b3d..6ab927cc40 100644
--- a/src/main/java/io/stargate/sgv2/jsonapi/config/OperationsConfig.java
+++ b/src/main/java/io/stargate/sgv2/jsonapi/config/OperationsConfig.java
@@ -34,6 +34,8 @@
/** Configuration for the operation execution. */
@ConfigMapping(prefix = "stargate.jsonapi.operations")
public interface OperationsConfig {
+ /** Defines the default max size of filter fields. */
+ int DEFAULT_MAX_FILTER_SIZE = 64;
/** @return Defines the default document page size, defaults to 20
. */
@Max(500)
@@ -85,6 +87,14 @@ public interface OperationsConfig {
@WithDefault("20")
int maxDocumentInsertCount();
+ /**
+ * @return Defines the max size of filter fields, defaults to {@code 64}. (note: this does not
+ * count the fields in '$operation' such as $in, $all)
+ */
+ @Positive
+ @WithDefault("" + DEFAULT_MAX_FILTER_SIZE)
+ int maxFilterObjectProperties();
+
/** @return Maximum size of values array that can be sent in $in/$nin operator */
@Max(100)
@Positive
diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/matcher/FilterableResolver.java b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/matcher/FilterableResolver.java
index fb5b39c0a1..abd0492a6d 100644
--- a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/matcher/FilterableResolver.java
+++ b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/matcher/FilterableResolver.java
@@ -4,7 +4,7 @@
import io.stargate.sgv2.jsonapi.api.model.command.CommandContext;
import io.stargate.sgv2.jsonapi.api.model.command.Filterable;
import io.stargate.sgv2.jsonapi.api.model.command.clause.filter.*;
-import io.stargate.sgv2.jsonapi.config.DocumentLimitsConfig;
+import io.stargate.sgv2.jsonapi.config.OperationsConfig;
import io.stargate.sgv2.jsonapi.config.constants.DocumentConstants;
import io.stargate.sgv2.jsonapi.exception.ErrorCode;
import io.stargate.sgv2.jsonapi.exception.JsonApiException;
@@ -44,7 +44,7 @@ public abstract class FilterableResolver {
private static final Object ARRAY_EQUALS = new Object();
private static final Object SUB_DOC_EQUALS = new Object();
- @Inject DocumentLimitsConfig docLimits;
+ @Inject OperationsConfig operationsConfig;
@Inject
public FilterableResolver() {
@@ -147,14 +147,14 @@ protected LogicalExpression resolve(CommandContext commandContext, T command) {
command.filterClause().validate(commandContext);
}
LogicalExpression filter = matchRules.apply(commandContext, command);
- if (filter.getTotalComparisonExpressionCount() > docLimits.maxFilterObjectProperties()) {
+ if (filter.getTotalComparisonExpressionCount() > operationsConfig.maxFilterObjectProperties()) {
throw new JsonApiException(
ErrorCode.FILTER_FIELDS_LIMIT_VIOLATION,
String.format(
"%s: filter has %d fields, exceeds maximum allowed %s",
ErrorCode.FILTER_FIELDS_LIMIT_VIOLATION.getMessage(),
filter.getTotalComparisonExpressionCount(),
- docLimits.maxFilterObjectProperties()));
+ operationsConfig.maxFilterObjectProperties()));
}
return filter;
}
diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindIntegrationTest.java
index 9bb4675fd6..93280f0807 100644
--- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindIntegrationTest.java
+++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindIntegrationTest.java
@@ -8,7 +8,7 @@
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.restassured.http.ContentType;
-import io.stargate.sgv2.jsonapi.config.DocumentLimitsConfig;
+import io.stargate.sgv2.jsonapi.config.OperationsConfig;
import io.stargate.sgv2.jsonapi.config.constants.HttpConstants;
import io.stargate.sgv2.jsonapi.testresource.DseTestResource;
import org.junit.jupiter.api.*;
@@ -1335,7 +1335,7 @@ public void exceedMaxFieldInFilter() {
"errors[0].message",
endsWith(
" filter has 65 fields, exceeds maximum allowed "
- + DocumentLimitsConfig.DEFAULT_MAX_FILTER_SIZE))
+ + OperationsConfig.DEFAULT_MAX_FILTER_SIZE))
.body("errors[0].errorCode", is("FILTER_FIELDS_LIMIT_VIOLATION"))
.body("errors[0].exceptionClass", is("JsonApiException"));
}