#!/bin/sh
+read _DATE _date_n <<-EOF
+ $(date +"%s %N")
+ EOF
+
. "${_EXEC:-${0%/*}}/cgilite/cgilite.sh"
. "${_EXEC:-${0%/*}}/cgilite/storage.sh"
. "${_EXEC:-${0%/*}}/cgilite/json.sh"
-[ "$_DATE" ] || _DATE="$(date +%s)"
-
debug "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL $_DATE"
ingest() {
)"
results="${results% }"
- times >&2
+ t="$(( ${_DATE}${_date_n} - $(date +%s%N) ))"
cat <<-EOF
Status: 200 OK\r
X-elastic-product: Elasticsearch\r
Content-Type: application/vnd.elasticsearch+json;compatible-with=8\r
\r
- { "took":0,
+ { "took":$((t / 1000)),
"timed_out":false,
"hits": {
"total":{"value": $(DB2 "$results" count @) ,"relation":"eq"},