I have created a partitioned collection where I need a Range index on a DateTime field (as ISO-8601) and Hash indexes on a few other fields. These are the fields I will only filter on, so I do not need indexes on any other fields.
I have defined my indexes like so (using extension methods):
indexingPolicy.IncludedPaths.Add("/playerId/?", new HashIndex(DataType.Number));
indexingPolicy.IncludedPaths.Add("/category/?", new HashIndex(DataType.String));
indexingPolicy.IncludedPaths.Add("/dateTime/?", new RangeIndex(DataType.String));
indexingPolicy.ExcludedPaths.Add(new ExcludedPath { Path = "/*" });
The strange thing is when I then check the indexing policy I can see a lot of extra indexes created that make no sense to me. See below the definitions and my comments.
[{
"path" : "/playerId/?",
"indexes" : [{
"kind" : "Hash",
"dataType" : "Number",
"precision" : 3
}, {
"kind" : "Hash",
"dataType" : "String", <<< It created an extra String Hash index
"precision" : 3
}
]
}, {
"path" : "/category/?",
"indexes" : [{
"kind" : "Hash",
"dataType" : "String",
"precision" : 3
}, {
"kind" : "Range",
"dataType" : "Number", <<< It created an extra Number Range index, this field is not numeric and I wanted a String Hash index only
"precision" : -1
}
]
}, {
"path" : "/dateTime/?",
"indexes" : [{
"kind" : "Range",
"dataType" : "String",
"precision" : -1
}, {
"kind" : "Range",
"dataType" : "Number", <<< It created an extra Number Range index, this field is not numeric and I wanted a String Range index only
"precision" : -1
}
]
}, {
Why would it create these indexes?