ES|QL JSON_STRING function
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Planned
Planned
Builds a JSON object string from key/value pairs.
key- A string key. Provide arguments as alternating key/value pairs.
value-
The value for the preceding key.
Builds a JSON object string from one or more key/value pairs. Keys must be strings. Numbers and booleans are rendered as JSON primitives, all other values are rendered as JSON strings. A multi-valued value is rendered as a JSON array and a null value as JSON null.
| key | value | result |
|---|---|---|
| keyword | boolean | keyword |
| keyword | date | keyword |
| keyword | date_nanos | keyword |
| keyword | double | keyword |
| keyword | integer | keyword |
| keyword | ip | keyword |
| keyword | keyword | keyword |
| keyword | long | keyword |
| keyword | text | keyword |
| keyword | unsigned_long | keyword |
| keyword | version | keyword |
| text | boolean | keyword |
| text | date | keyword |
| text | date_nanos | keyword |
| text | double | keyword |
| text | integer | keyword |
| text | ip | keyword |
| text | keyword | keyword |
| text | long | keyword |
| text | text | keyword |
| text | unsigned_long | keyword |
| text | version | keyword |
ROW name = "Sydney", population = 5312163
| EVAL doc = JSON_STRING("city", name, "population", population)
| doc:keyword |
|---|
| {"city":"Sydney","population":5312163} |