Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titlespa.sh
#!/usr/bin/env bash

SOURCE_URL=http://spa.jmehan.com/info/
ELASTIC_URL=localhost:9200/spa/1
TMP_FILE=spa.tmp


HEADER1="Content-Type: application/json"
HEADER2="Cache-Control: no-cache"


curl -L $SOURCE_URL -o $TMP_FILE
curl -s -XPOST -H "$HEADER1" -H "$HEADER2" $ELASTIC_URL --data-binary @$TMP_FILE


rm $TMP_FILE

Using JQ for JSON manipulation


Merging files

Code Block
jq -s '.[0] * .[1]' file.json file2.json


Extracting portions

Code Block
jq '.[0].value file.json


Practice your jq using: https://jqplay.org/ 


Manipulating ElasticSearch data

...