You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/search-indexer-field-mappings.md
+12-20Lines changed: 12 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Some situations where field mappings are useful:
25
25
* You need to Base64 encode or decode your data. Field mappings support several **mapping functions**, including functions for Base64 encoding and decoding.
26
26
27
27
> [!NOTE]
28
-
> The field mapping feature of Azure Search indexers provides a simple way to map data fields to index fields, with a few options for data conversion. More complex data might require pre-processing to transform it into a form that's easy to index.
28
+
> The field mapping feature of Azure Search indexers provides a simple way to map data fields to index fields, with a few options for data conversion. More complex data might require pre-processing to reshape it into a form that's easy to index.
29
29
>
30
30
> Microsoft Azure Data Factory is a powerful cloud-based solution for importing and transforming data. You can also write code to transform source data before indexing. For code examples, see [Model relational data](search-example-adventureworks-modeling.md) and [Model multilevel facets](search-example-adventureworks-multilevel-faceting.md).
31
31
>
@@ -118,21 +118,9 @@ Performs *URL-safe* Base64 encoding of the input string. Assumes that the input
118
118
119
119
#### Example - document key lookup
120
120
121
-
Only URL-safe characters can appear in an Azure Search document key (because customers must be able to address the document using the [Lookup API](https://docs.microsoft.com/rest/api/searchservice/lookup-document) ). If your data contains URL-unsafe characters and you want to use it to populate a key field in your search index, use this function. Once the key is encoded, you can use base64 decode to retrieve the original value. For details, see the [base64 encoding and decoding](#base64details) section.
121
+
Only URL-safe characters can appear in an Azure Search document key (because customers must be able to address the document using the [Lookup API](https://docs.microsoft.com/rest/api/searchservice/lookup-document) ). If the source field for your key contains URL-unsafe characters, you can use the `base64Encode` function to convert it at indexing time.
122
122
123
-
```JSON
124
-
125
-
"fieldMappings" : [
126
-
{
127
-
"sourceFieldName" : "SourceKey",
128
-
"targetFieldName" : "IndexKey",
129
-
"mappingFunction" : { "name" : "base64Encode" }
130
-
}]
131
-
```
132
-
133
-
#### Example - retrieve original key
134
-
135
-
You have a blob indexer that indexes blobs with the blob path metadata as the document key. After retrieving the encoded document key, you want to decode the path and download the blob.
123
+
When you retrieve the encoded key at search time, you can then use the `base64Decode` function to get the original key value, and use that to retrieve the source document.
136
124
137
125
```JSON
138
126
@@ -147,17 +135,19 @@ You have a blob indexer that indexes blobs with the blob path metadata as the do
147
135
}]
148
136
```
149
137
150
-
If you don't need to look up documents by keys and also don't need to decode the encoded content, you can just leave out `parameters` for the mapping function, which defaults `useHttpServerUtilityUrlTokenEncode` to `true`. Otherwise, see [base64 details](#base64details) section to decide which settings to use.
138
+
If you don't include a parameters property for your mapping function, it defaults to the value `{"useHttpServerUtilityUrlTokenEncode" : true}`.
139
+
140
+
Azure Search supports two different Base64 encodings. You should use the same parameters when encoding and decoding the same field. For more details, see [base64 encoding options](#base64details) to decide which parameters to use.
151
141
152
142
<aname="base64DecodeFunction"></a>
153
143
154
144
### base64Decode function
155
145
156
146
Performs Base64 decoding of the input string. The input is assumed to be a *URL-safe* Base64-encoded string.
157
147
158
-
#### Example - decode blob metadata
148
+
#### Example - decode blob metadata or URLs
159
149
160
-
Blob custom metadata values must be ASCII-encoded. You can use Base64 encoding to represent arbitrary UTF-8 strings in blob custom metadata. To make search data more meaningful, you can use the base64Decode function to turn the encoded data back into regular strings when populating your search index.
150
+
Your source data might contain contains Base64-encoded strings, such as blob metadata strings or web URLs, that you want to make searchable as plain text. You can use the `base64Decode` function to turn the encoded data back into regular strings when populating your search index.
161
151
162
152
```JSON
163
153
@@ -172,11 +162,13 @@ Blob custom metadata values must be ASCII-encoded. You can use Base64 encoding t
172
162
}]
173
163
```
174
164
175
-
If you don't specify any `parameters`, then the default value of `useHttpServerUtilityUrlTokenDecode` is `true`. See the [base64 encoding options](#base64details) section to decide which settings to use.
165
+
If you don't include a parameters property, it defaults to the value `{"useHttpServerUtilityUrlTokenEncode" : true}`.
166
+
167
+
Azure Search supports two different Base64 encodings. You should use the same parameters when encoding and decoding the same field. For more details, see [base64 encoding options](#base64details) to decide which parameters to use.
176
168
177
169
<aname="base64details"></a>
178
170
179
-
### base64 encoding options
171
+
####base64 encoding options
180
172
181
173
Azure Search supports two different Base64 encodings: **HttpServerUtility URL token**, and **URL-safe Base64 encoding without padding**. You must use the same encoding as the mapping functions to encode a document key for lookup, encode a value that will be decoded by the indexer, or decode a field that was encoded by the indexer.
0 commit comments