0
votes

In order to automatically index Azure Storage blobs with Azure Search, an index need to have one of its fields as a unique "key". Azure docs say: "There can only be one key field in the index. It has to be a string field. This field represents the unique identifier for each document stored with the index."

My question is: what is the best unique key for a blob? It cannot be a blob path or name, since "/" and "." cannot be in the "key" value. Shall I assign a customized property to every blob after I upload it to Azure Storage?

What would be the best way to do it? Is anyone here has experience with that?

1

1 Answers

0
votes

Based on this link, you could use metadata_storage_path attribute (which represents full blob path and thus unique) as key field. Again based on the documentation, you should use base64Encode function to convert that data into Base64 encoded string to avoid invalid characters in the key name field value.

From the documentation link (please see section titled Defining document keys and field mappings):

metadata_storage_path - using the full path ensures uniqueness, but the path definitely contains / characters that are invalid in a document key. As above, you have the option of encoding the keys using the base64Encode function.