TDV Adapter for Elasticsearch

Build 21.0.8137

FlattenArrays

Set FlattenArrays to the number of nested array elements you want to return as table columns. By default, nested arrays are returned as strings of JSON.

Data Type

string

Default Value

""

Remarks

By default, nested arrays are returned as strings of JSON. The FlattenArrays property can be used to flatten the elements of nested arrays into columns of their own. This is only recommended for arrays that are expected to be short.

Set FlattenArrays to the number of elements you want to return from nested arrays. The specified elements are returned as columns. The zero-based index is concatenated to the column name. Other elements are ignored.

For example, you can return an arbitrary number of elements from an array of strings:

"employees": [
  {
    "name": "John Smith",
    "age": 34
  },
  {
    "name": "Peter Brown",
    "age": 26
  },
  {
    "name": "Paul Jacobs",
    "age": 30
  }
]
When FlattenArrays is set to 2, the preceding array is flattened into the following table:

Column NameColumn Value
employees.0.nameJohn Smith
employees.0.age34
employees.1.namePeter Brown
employees.1.age26

See JSON Functions to use JSON paths to work with unbounded arrays.

Copyright (c) 2022 CData Software, Inc. - All rights reserved.
Build 21.0.8137