JQ is really nice for working with ElasticSearch:

$ curl -s localhost:9200/indx/type/_search jq -r ‘.hits.hits map(._id) join(“n”)’