Skip to content

Instantly share code, notes, and snippets.

@cdecl
Last active June 24, 2021 08:11
Show Gist options
  • Save cdecl/9d7e27d878cf48cff6879f80a836adad to your computer and use it in GitHub Desktop.
Save cdecl/9d7e27d878cf48cff6879f80a836adad to your computer and use it in GitHub Desktop.
elastic search sql query result to json(ndjson)
#!/bin/bash
cat result.json | jq -c ' { "col": [.columns[] | .name], "row" : .rows[] }
| [.col, .row]
| transpose
| map({ (.[0]): .[1] })
| add ' >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment