diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java index 0cde4b0692b2..7816baf073f6 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java @@ -166,16 +166,10 @@ DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "getPrecision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/WorkflowTest.java b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/WorkflowTest.java index 5396098bab58..74706117fb62 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/WorkflowTest.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/WorkflowTest.java @@ -306,16 +306,10 @@ DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "precision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/CollectionCRUDAsyncAPITest.java b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/CollectionCRUDAsyncAPITest.java index a3ac36be2efe..817c3e927a5e 100644 --- a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/CollectionCRUDAsyncAPITest.java +++ b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/CollectionCRUDAsyncAPITest.java @@ -380,16 +380,10 @@ private DocumentCollection getMultiPartitionCollectionDefinition() { // Set indexing policy to be range range for string and number IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "getPrecision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/OfferCRUDAsyncAPITest.java b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/OfferCRUDAsyncAPITest.java index e18679b6d079..6933f3599f68 100644 --- a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/OfferCRUDAsyncAPITest.java +++ b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/OfferCRUDAsyncAPITest.java @@ -141,16 +141,10 @@ private DocumentCollection getMultiPartitionCollectionDefinition() { // Set indexing policy to be range range for string and number IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "precision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/StoredProcedureAsyncAPITest.java b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/StoredProcedureAsyncAPITest.java index d3a3f8b1bdb2..18bac07ce1e3 100644 --- a/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/StoredProcedureAsyncAPITest.java +++ b/sdk/cosmos/azure-cosmos-examples/src/test/java/com/azure/cosmos/rx/examples/StoredProcedureAsyncAPITest.java @@ -230,16 +230,10 @@ private static DocumentCollection getMultiPartitionCollectionDefinition() { // Set indexing policy to be range range for string and number IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); + IncludedPath includedPath = new IncludedPath("/*"); List indexes = new ArrayList(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "precision", -1); - indexes.add(numberIndex); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ExcludedPath.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ExcludedPath.java index 2995d6c974c8..d836ded67750 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ExcludedPath.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ExcludedPath.java @@ -13,20 +13,14 @@ public final class ExcludedPath { private JsonSerializable jsonSerializable; - /** - * Constructor. - */ - public ExcludedPath() { - this.jsonSerializable = new JsonSerializable(); - } - /** * Constructor. * - * @param jsonString the json string that represents the excluded path. + * @param path the excluded path. */ - ExcludedPath(String jsonString) { - this.jsonSerializable = new JsonSerializable(jsonString); + public ExcludedPath(String path) { + this.jsonSerializable = new JsonSerializable(); + this.setPath(path); } /** @@ -51,7 +45,7 @@ public String getPath() { * Sets path. * * @param path the path. - * @return the Exculded path. + * @return the excluded path. */ public ExcludedPath setPath(String path) { this.jsonSerializable.set(Constants.Properties.PATH, path); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IncludedPath.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IncludedPath.java index a3194291e4ff..81fd8835bd08 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IncludedPath.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IncludedPath.java @@ -6,35 +6,29 @@ import com.azure.cosmos.implementation.Constants; import com.azure.cosmos.implementation.IndexKind; import com.azure.cosmos.implementation.JsonSerializable; +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; -import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.ArrayList; -import java.util.Collection; +import java.util.List; /** * Represents an included path of the IndexingPolicy in the Azure Cosmos DB database service. */ public final class IncludedPath { - private Collection indexes; + private List indexes; private JsonSerializable jsonSerializable; - /** - * Constructor. - */ - public IncludedPath() { - this.jsonSerializable = new JsonSerializable(); - } - /** * Constructor. * - * @param jsonString the json string that represents the included path. + * @param path the included path. */ - public IncludedPath(String jsonString) { - this.jsonSerializable = new JsonSerializable(jsonString); + public IncludedPath(String path) { + this.jsonSerializable = new JsonSerializable(); + this.setPath(path); } /** @@ -71,7 +65,7 @@ public IncludedPath setPath(String path) { * * @return the included paths. */ - public Collection getIndexes() { + public List getIndexes() { if (this.indexes == null) { this.indexes = this.getIndexCollection(); @@ -89,15 +83,15 @@ public Collection getIndexes() { * @param indexes the indexes * @return the indexes */ - public IncludedPath setIndexes(Collection indexes) { + public IncludedPath setIndexes(List indexes) { this.indexes = indexes; return this; } - private Collection getIndexCollection() { + private List getIndexCollection() { if (this.jsonSerializable.getPropertyBag() != null && this.jsonSerializable.getPropertyBag().has(Constants.Properties.INDEXES)) { ArrayNode jsonArray = (ArrayNode) this.jsonSerializable.getPropertyBag().get(Constants.Properties.INDEXES); - Collection result = new ArrayList(); + List result = new ArrayList(); for (int i = 0; i < jsonArray.size(); i++) { JsonNode jsonObject = jsonArray.get(i); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java index 3834012e2231..a179f114d1e1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/IndexingPolicy.java @@ -62,8 +62,7 @@ public IndexingPolicy(Index[] defaultIndexOverrides) { throw new IllegalArgumentException("defaultIndexOverrides is null."); } - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); + IncludedPath includedPath = new IncludedPath(IndexingPolicy.DEFAULT_PATH); includedPath.setIndexes(new ArrayList(Arrays.asList(defaultIndexOverrides))); this.getIncludedPaths().add(includedPath); } @@ -264,8 +263,7 @@ void populatePropertyBag() { // If indexing mode is not 'none' and not paths are set, set them to the defaults if (this.getIndexingMode() != IndexingMode.NONE && this.getIncludedPaths().size() == 0 && this.getExcludedPaths().size() == 0) { - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); + IncludedPath includedPath = new IncludedPath(IndexingPolicy.DEFAULT_PATH); this.getIncludedPaths().add(includedPath); } diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java index f2e79592c368..90e48b72de18 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java @@ -477,16 +477,10 @@ static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "precision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/IncludedPathTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/IncludedPathTest.java index 1cdbc39dc1be..181373448327 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/IncludedPathTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/models/IncludedPathTest.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.cosmos.models; -import org.assertj.core.api.Assertions; import org.testng.annotations.Test; import java.util.ArrayList; @@ -13,28 +12,22 @@ public class IncludedPathTest { @Test(groups = {"unit"}) - public void deserialize() { - String json = "{" + - " 'path': '\\/*'," + - " 'indexes': [" + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'String'," + - " 'precision': -1" + - " }," + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'Number'," + - " 'precision': -1" + - " }" + - " ]" + - "}"; - IncludedPath path = new IncludedPath(json); - List indexes = new ArrayList<>(path.getIndexes()); - Assertions.assertThat(indexes).hasSize(2); - Assertions.assertThat(((RangeIndex) indexes.get(0)).getDataType()).isEqualTo(DataType.STRING); - Assertions.assertThat(((RangeIndex) indexes.get(0)).getPrecision()).isEqualTo(-1); - Assertions.assertThat(((RangeIndex) indexes.get(1)).getDataType()).isEqualTo(DataType.NUMBER); - Assertions.assertThat(((RangeIndex) indexes.get(1)).getPrecision()).isEqualTo(-1); + public void setAndGetIncludedPath() { + String path = "/*"; + IncludedPath includedPath = new IncludedPath(path); + + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); + includedPath.setIndexes(indexes); + + List includedPathIndexes = new ArrayList<>(includedPath.getIndexes()); + assertThat(includedPathIndexes).hasSize(2); + assertThat(((RangeIndex) includedPathIndexes.get(0)).getDataType()).isEqualTo(DataType.STRING); + assertThat(((RangeIndex) includedPathIndexes.get(0)).getPrecision()).isEqualTo(-1); + assertThat(((RangeIndex) includedPathIndexes.get(1)).getDataType()).isEqualTo(DataType.NUMBER); + assertThat(((RangeIndex) includedPathIndexes.get(1)).getPrecision()).isEqualTo(-1); + + assertThat(includedPath.getPath()).isEqualTo(path); } } diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java index 025b04457360..72e51e0427f3 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java @@ -69,16 +69,10 @@ static protected CosmosContainerProperties getCollectionDefinition() { IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "getPrecision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java index 74056f802869..8ef4dbf42936 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java @@ -537,16 +537,10 @@ static protected CosmosContainerProperties getCollectionDefinitionWithRangeRange partitionKeyDef.setPaths(partitionKeyPath); IndexingPolicy indexingPolicy = new IndexingPolicy(); List includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.range(DataType.STRING); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.range(DataType.NUMBER); - BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "precision", -1); - indexes.add(numberIndex); + IncludedPath includedPath = new IncludedPath("/*"); + List indexes = new ArrayList<>(); + indexes.add(Index.range(DataType.STRING, -1)); + indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/UniqueIndexTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/UniqueIndexTest.java index 1bd1763ab0a0..d39e7d3af6e9 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/UniqueIndexTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/UniqueIndexTest.java @@ -72,17 +72,14 @@ public void insertWithUniqueIndex() throws Exception { IndexingPolicy indexingPolicy = new IndexingPolicy(); indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); + ExcludedPath excludedPath = new ExcludedPath("/*"); indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); + IncludedPath includedPath1 = new IncludedPath("/name/?"); includedPath1.setIndexes(Collections.singletonList(Index.hash(DataType.STRING, 7))); includedPath1.setIndexes(Collections.singletonList(Index.hash(DataType.STRING, 7))); - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); includedPath2.setIndexes(Collections.singletonList(Index.hash(DataType.STRING, 7))); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); collectionDefinition.setIndexingPolicy(indexingPolicy); @@ -181,16 +178,13 @@ public void uniqueKeySerializationDeserialization() { IndexingPolicy indexingPolicy = new IndexingPolicy(); indexingPolicy.setIndexingMode(IndexingMode.CONSISTENT); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); + ExcludedPath excludedPath = new ExcludedPath("/*"); indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); + IncludedPath includedPath1 = new IncludedPath("/name/?"); includedPath1.setIndexes(Collections.singletonList(Index.hash(DataType.STRING, 7))); - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); + IncludedPath includedPath2 = new IncludedPath("/description/?"); includedPath2.setIndexes(Collections.singletonList(Index.hash(DataType.STRING, 7))); indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2));