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
### `JSON_KEYS`
**Description**
`json_keys(doc [, path])` Returns an array of all keys of the object at path in the JSON document. If path is not specified, returns the keys at the root of the JSON document.
**Argument type:** OBJECT, STRING
A STRING expression of a valid JSON document.
**Return type:** ARRAY
`json_keys(doc, paths)` Returns an array of all keys of the object at the given paths in the JSON document.
**Argument type:** OBJECT, ARRAY
A STRING expression of a valid JSON document.
**Return type:** ARRAY
`NULL` is returned from an invalid JSON.
Example:
os> source=people | eval `keys` = json_keys(json('{"f1":"abc","f2":{"f3":"a","f4":"b"}}'))
fetched rows / total rows = 1/1
+------------+
| keys |
+------------+
| [f1, f2] |
+------------+
os> source=people | eval `keys` = json_keys(json('{"f1":"abc","f2":{"f3":"a","f4":"b"}}'), "f1", "f2")
fetched rows / total rows = 1/1
+------------+
| keys |
+------------+
| [f3, f4] |
+------------+
os> source=people | eval `keys` = json_keys(json('{"f1":"abc","f2":{"f3":"a","f4":"b"}}'), json_array("{}", "f2"))
fetched rows / total rows = 1/1
+------------+
| keys |
+------------+
| [f1, f2, f3, f4] |
+------------+
os> source=people | eval `keys` = json_keys(json('[1,2,3,{"f1":1,"f2":[5,6]},4]'))
fetched rows / total rows = 1/1
+--------+
| keys |
+--------+
| null |
+--------+
Is your feature request related to a problem?
As part of the RFC to add JSON functions, the
json_keys
function would be useful to extract a list of keys at a path from a json documentsJSON
extended functions support #3027JSON
extended functions support #3028JSON
functions: construction and extraction opensearch-spark#780What solution would you like?
What alternatives have you considered?
N/A
Do you have any additional context?
opensearch-project/opensearch-spark#780 - PR to add json objects to opensearch-spark PPL
The text was updated successfully, but these errors were encountered: