I want to produce a custom json line and display it together with another. I can only display one json line right now. I need to display the two sequentially. I'm adding property "index" to property "hits" with curl data.json | jq '{"index": {"index": {}}} + .hits.hits[]'
I've tried to pipe using jq '.index + ._source'
, but that just concatenates the property to _source. I've tried jq .index ._source
, but that's an error.
I can select either _source or .index by piping the result jq ._source
or jq .index
. That will produce json lines correctly. That's fine. Now I need the .index, before each json line of ._source.
I need the result to look like this:
{"index": {}}
{/* ._source json line*/}
{"index": {}}
{/* ._source json line*/}
and so on...
Thank you!