The "partialKey" property defines the range of returned records. The "getRecordsByPartialKeyRange" action uses the "partialKey" to find a starting position in the index where it can start returning records. This property is optional and defaults to "" or [] unless used in Key-Value actions. In Key-Value actions, this property is required.
- When the index key is based on one field, the
"partialKey"property can be a string that contains some or all of the key values. The value must start from the beginning of the key.- When a field is stored in the index in reverse order, the
"partialKey"property must start with bytes from the end of the key in reverse order. This allows you to do a partial match starting from the end of the key. To create a reverse order key, create the index and set one or more fields in the index to"reverseCompare": true.
- When a field is stored in the index in reverse order, the
- You must include one value for each field in the index in the order the fields are in the index. The last field in the index may be omitted or may contain a partial key.
- There are two forms of the
"partialKey"property a string and an array. - The method finds the starting record by matching all the bytes in the
"partialKey"value to the initial bytes in the indexes' keys. - A zero-length value matches all index keys.
- All values in the array, except for the last, must represent a complete field value.
- Only the last value in the array may be a partial value.
- The fields must be placed in the array in index order.
- Each value in the array must be compatible with the data type of its corresponding field.
- JSON true or false for
"bit"field. - JSON number for all number fields.
- JSON string for
"char","varchar","lvarchar","binary","varbinary", and"lvarbinary"fields.
- JSON true or false for
- A binary value is embedded in a string and is encoded as
"base64"or"hex"according to the setting of"binaryFormat".
Note The Array (multi-field) shows how to use
"partialKey"when an index contains five fields ("date","bit","varchar","double", and"varbinary"). The values for"date","bit","varchar", and"double"cannot be partial values because they occur before the last field. The binary value in the"varbinary"field is encoded as base64 and since it is the last field it can contain a partial binary key.
String
"partialKey": "Mi"
Array (multi-field)
"partialKey": [ "2023-01-01", true, "full string", -3.4, "TWk=" ]
Key-Value action differences
In the Key-Value API, the required "partialKey" property retrieves child keys from a key hierarchy. It defines the base hierarchical level of returned keys, such as "partialKey": "myApp/queries/". The action uses an index on the key to find all keys that match the characters specified in "partialKey". Keys are case sensitive.
To ensure the action matches the hierarchical levels you want, include the hierarchical delimiter at the end of the partial key, such as "myApp/queries/".
You can use "partialKey": "" to return all keys in the store.