@@ -169,11 +169,6 @@ Nested Field Schema Example
169
169
The converter handles schemas with nested key or value structures.
170
170
The following is an example AVRO schema with nested fields:
171
171
172
- Note the use of :manual:`dot notation </core/document/index.html#dot-notation>`
173
- in the ``address.city`` and ``address.country`` fields. Dot notation allows
174
- you to specify nested fields without writing separate lines for the top-level
175
- document and its sub-documents.
176
-
177
172
.. code-block:: json
178
173
179
174
{
@@ -194,11 +189,21 @@ document and its sub-documents.
194
189
"type": "boolean"
195
190
},
196
191
{
197
- "name": "address.city",
198
- "type": "string"
199
- {
200
- "name": "address.country",
201
- "type": string"
192
+ "name": "address",
193
+ "type": {
194
+ "type": "record",
195
+ "name": "AddressRecord",
196
+ "fields": [
197
+ {
198
+ "name": "city",
199
+ "type": "string"
200
+ },
201
+ {
202
+ "name": "country",
203
+ "type": "string"
204
+ }
205
+ ]
206
+ }
202
207
},
203
208
{
204
209
"name": "food",
@@ -241,6 +246,26 @@ document and its sub-documents.
241
246
]
242
247
}
243
248
249
+ Dot Notation for Nested Fields
250
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
251
+
252
+ In the above schema example, the ``address`` field is a document with two
253
+ sub-fields, ``city`` and ``country``. It's also possible to specify those
254
+ fields with dot notation:
255
+
256
+ .. code-block:: json
257
+
258
+ {
259
+ "name": "address.city",
260
+ "type": "string"
261
+ },
262
+ {
263
+ "name": "address.country",
264
+ "type": string"
265
+ }
266
+
267
+ Dot notation allows you to specify nested fields without using separate
268
+ lines for the top-level document and its sub-documents.
244
269
245
270
.. _avro-logical-types-example:
246
271
0 commit comments