Hello,
I’m attempting to proxy to Grafana via an express app that I have created. The body parser middleware that is used, however, doesn’t like the request payloads that are used to query my elasticsearch datasource.
An example request payload:
{"search_type":"query_then_fetch","ignore_unavailable":true,"index":"caduceus-*"}
{"size":0,"query":{"bool":{"filter":[{"range":{"timestamp":
{"gte":"1540564126940","lte":"1541798926940","format":"epoch_millis"}}},{"query_string":
{"analyze_wildcard":true,"query":"*"}}]}},"aggs":{"1":{"terms":{"field":"serial","size":500,"order":
{"_term":"asc"}}}}}
An example of the error that I receive is:
SyntaxError: Unexpected token { in JSON at position 82
at JSON.parse (<anonymous>)
at parse (/srv/www/node_modules/body-parser/lib/types/json.js:89:19)
at /srv/www/node_modules/body-parser/lib/read.js:121:18
at invokeCallback (/srv/www/node_modules/raw-body/index.js:224:16)
at done (/srv/www/node_modules/raw-body/index.js:213:7)
at IncomingMessage.onEnd (/srv/www/node_modules/raw-body/index.js:273:7)
at IncomingMessage.emit (events.js:197:13)
at endReadableNT (_stream_readable.js:1129:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
Any thoughts? Is this just a quirk of the Elasticsearch API?